commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. release-2.2-275-ge20d435


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-275-ge20d435
Date: Wed, 08 Dec 2010 17:55:40 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=e20d435c8e310046c15acbdf47fa458fe7ead1ae

The branch, master has been updated
       via  e20d435c8e310046c15acbdf47fa458fe7ead1ae (commit)
       via  06fb6b02b42973f8a036cd7288fe7e1f609801b7 (commit)
      from  75755ec7febf8c891b4b809120f3da77e1e15549 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e20d435c8e310046c15acbdf47fa458fe7ead1ae
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed Dec 8 19:46:44 2010 +0200

    Minor improvements in logstream and related code.
    
    * include/mailutils/stream.h (MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE)
    (MU_IOCTL_LOGSTREAM_SET_LOCUS_COL): New subcodes.
    * libmailutils/stream/logstream.c (_log_ctl): Handle two new subcodes.
    * comsat/action.c (eval_biffrc): Use new ioctl subcode to update the
    line number.

commit 06fb6b02b42973f8a036cd7288fe7e1f609801b7
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed Dec 8 19:08:51 2010 +0200

    Test line info facility
    
    * libmailutils/tests/inline-comment.at: Add line info tests.
    * libmailutils/tests/linecon.at: Likewise.
    * libmailutils/filter/linecon.c (LINECON_CONTINUATION): New flag.
    (linecon_newline): Remove.
    (_linecon_decoder): Correctly determine the end of continuation
    in case when the last line contained standalone escapes.

-----------------------------------------------------------------------

Summary of changes:
 comsat/action.c                      |   24 ++++++++++++------
 include/mailutils/stream.h           |   18 ++++++++++---
 libmailutils/filter/linecon.c        |   20 ++++++++-------
 libmailutils/stream/logstream.c      |   12 +++++++++
 libmailutils/tests/inline-comment.at |   25 +++++++++++++++++-
 libmailutils/tests/linecon.at        |   44 ++++++++++++++++++++++++++++++++-
 6 files changed, 118 insertions(+), 25 deletions(-)

diff --git a/comsat/action.c b/comsat/action.c
index 28ac348..2d9aa39 100644
--- a/comsat/action.c
+++ b/comsat/action.c
@@ -522,12 +522,12 @@ eval_biffrc (struct biffrc_environ *env)
   
   ws.ws_comment = "#";
   wsflags = MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT;
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
+                  MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus);
+  mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM,
+                  MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus);
   while (mu_stream_getline (env->input, &stmt, &size, &n) == 0 && n > 0)
     {
-      mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
-                      MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus);
-      mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM,
-                      MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus);
       if (strncmp (stmt, "#line ", 6) == 0)
        {
          char *p;
@@ -540,9 +540,11 @@ eval_biffrc (struct biffrc_environ *env)
          else
            {
              mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
-                              MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus);
+                              MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE,
+                              &env->locus.mu_line);
              mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM,
-                              MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus);
+                              MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE,
+                              &env->locus.mu_line);
            }
          continue;
        }
@@ -553,7 +555,10 @@ eval_biffrc (struct biffrc_environ *env)
          
          if (ws.ws_wordc == 0)
            {
-             env->locus.mu_line++;
+             mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
+                              MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL);
+             mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM,
+                              MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL);
              continue;
            }
 
@@ -591,7 +596,10 @@ eval_biffrc (struct biffrc_environ *env)
        report_error (env, "%s", mu_wordsplit_strerror (&ws));
       
       wsflags |= MU_WRDSF_REUSE;
-      env->locus.mu_line++;
+      mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
+                      MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL);
+      mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM,
+                      MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL);
     }
   free (stmt);
   mu_wordsplit_free (&ws);
diff --git a/include/mailutils/stream.h b/include/mailutils/stream.h
index 407b45a..9b88097 100644
--- a/include/mailutils/stream.h
+++ b/include/mailutils/stream.h
@@ -108,26 +108,36 @@ enum mu_buffer_type
 #define MU_IOCTL_LOGSTREAM_GET_MODE     4
 #define MU_IOCTL_LOGSTREAM_SET_MODE     5
 
+  /* Set locus line.
+     Arg: unsigned *
+  */
+#define MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE  6
+  /* Set locus column.
+     Arg: unsigned *
+  */
+#define MU_IOCTL_LOGSTREAM_SET_LOCUS_COL   7
+  
   /* Advance locus line.
      Arg: NULL (increment by 1)
           int *
   */
-#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE 6
+#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE 8
   /* Advance locus column.
      Arg: NULL (increment by 1)
           int *
   */
-#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL  7
+
+#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL  9
 
   /* Suppress output of messages having severity lower than the
      given threshold.
      Arg: int *
   */
-#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY  8
+#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY  10
   /* Same as above, but:
      Arg: const char *
   */
-#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME 9
+#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME 11
 
   /* Opcodes for MU_IOCTL_XSCRIPTSTREAM */
   /* Swap transcript levels.
diff --git a/libmailutils/filter/linecon.c b/libmailutils/filter/linecon.c
index 5c96168..f9ebffd 100644
--- a/libmailutils/filter/linecon.c
+++ b/libmailutils/filter/linecon.c
@@ -40,14 +40,15 @@
 #include <mailutils/io.h>
 
 #define LINECON_LINE_INFO          0x01 /* Emit line number information */ 
-#define LINECON_LINE_INFO_STATIC   0x02
+#define LINECON_LINE_INFO_STATIC   0x02 /* Line info starter is in static
+                                          storage */
+#define LINECON_CONTINUATION       0x04 /* Line continuation in progress */
 
 enum linecon_state
   {
-    linecon_init,
-    linecon_escape,
-    linecon_newline,
-    linecon_rollback
+    linecon_init,                  /* Initial state */ 
+    linecon_escape,                /* An escape was seen */
+    linecon_rollback               /* Rollback in progress */
   };
 
 struct linecon_data
@@ -98,7 +99,6 @@ _linecon_decoder (void *xd, enum mu_filter_command cmd,
       switch (pd->state)
        {
        case linecon_init:
-       case linecon_newline:
          switch (*iptr)
            {
            case '\\':
@@ -107,8 +107,9 @@ _linecon_decoder (void *xd, enum mu_filter_command cmd,
              continue;
            case '\n':
              pd->line_number++;
-             if (pd->state == linecon_newline)
+             if (pd->flags & LINECON_CONTINUATION)
                {
+                 pd->flags &= ~LINECON_CONTINUATION;
                  mu_asnprintf (&pd->buf, &pd->size, "%s %lu\n",
                                pd->line_info_starter,
                                pd->line_number);
@@ -128,8 +129,9 @@ _linecon_decoder (void *xd, enum mu_filter_command cmd,
            {
              pd->line_number++;
              iptr++;
-             pd->state = (pd->flags & LINECON_LINE_INFO) ?
-                            linecon_newline : linecon_init;
+             pd->state = linecon_init;
+             if (pd->flags & LINECON_LINE_INFO)
+               pd->flags |= LINECON_CONTINUATION;
              continue;
            }
          else
diff --git a/libmailutils/stream/logstream.c b/libmailutils/stream/logstream.c
index aa4a7d0..d8cf6df 100644
--- a/libmailutils/stream/logstream.c
+++ b/libmailutils/stream/logstream.c
@@ -378,6 +378,18 @@ _log_ctl (struct _mu_stream *str, int code, int opcode, 
void *arg)
            break;
          }
 
+       case MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE:
+         if (!arg)
+           return EINVAL;
+         sp->locus.mu_line = *(unsigned*)arg;
+         break;
+         
+       case MU_IOCTL_LOGSTREAM_SET_LOCUS_COL:
+         if (!arg)
+           return EINVAL;
+         sp->locus.mu_col = *(unsigned*)arg;
+         break;
+         
        case MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE:
          if (!arg)
            sp->locus.mu_line++;
diff --git a/libmailutils/tests/inline-comment.at 
b/libmailutils/tests/inline-comment.at
index 2dba3e2..5df6300 100644
--- a/libmailutils/tests/inline-comment.at
+++ b/libmailutils/tests/inline-comment.at
@@ -156,8 +156,29 @@ text 4
      text 5[]dnl
 ])     
 
+INLINECOM([line info facility],[icmt07 line-info],[-- -i ';line' ';'],
+[; initial comment
+this is line 2
+this is line 3
+; A long contiguous
+; sequence
+; of comments
+; occupying several
+; lines
+this is line 9
+],
+[;line 2
+this is line 2
+this is line 3
+;line 9
+this is line 9
+])
+
+dnl -------------------------------------------------------------------
+
 m4_define([FILTER_MODE],[encode])
-INLINECOM([encode],[icmt07],[],
+
+INLINECOM([encode],[icmt08],[],
 [C'est dans dix ans je m'en irai
 J'entends le loup et le renard chanter
 J'entends le loup, le renard et la belette
@@ -167,7 +188,7 @@ J'entends le loup et le renard chanter],
 ;J'entends le loup, le renard et la belette
 ;J'entends le loup et le renard chanter])
 
-INLINECOM([encode multichar; add ws],[icmt07],[-- NB: -S],
+INLINECOM([encode multichar; add ws],[icmt09],[-- NB: -S],
 [Tri martolod yaouank
 O voned da voyagi
 Gant'el oant bet kaset
diff --git a/libmailutils/tests/linecon.at b/libmailutils/tests/linecon.at
index c9c8eaa..2cf867f 100644
--- a/libmailutils/tests/linecon.at
+++ b/libmailutils/tests/linecon.at
@@ -16,7 +16,7 @@
 
 AT_SETUP([linecon filter])
 AT_KEYWORDS([filter decode linecon])
-sed 's/\$//' > input <<EOT
+sed 's/\$//' > input <<\EOT
 input line 1
 input line 2
 a very\
@@ -27,7 +27,7 @@ it over several physical\
 a li\ne with \escapes
 backslash followed by a space \ $
 EOT
-sed 's/\$//' > expout <<EOT
+sed 's/\$//' > expout <<\EOT
 input line 1
 input line 2
 a very long logical line split over several physical ones
@@ -45,5 +45,45 @@ AT_CHECK([fltst linecon decode write < input],
 
 AT_CLEANUP
 
+dnl ---------------------------------------------------------------
+
+AT_SETUP([linecon filter: line info facility])
+AT_KEYWORDS([filter decode linecon line-info])
+sed 's/\$//' > input <<\EOT
+input line 1
+input line 2
+a very\$
+ long logical\
+ line spl\
+it over several physical\
+ ones
+a li\ne with \escapes
+backslash followed by a space \ $
+another\
+ split line\\\n
+end of test 
+EOT
+sed 's/\$//' > expout <<\EOT
+input line 1
+input line 2
+a very long logical line split over several physical ones
+;line 8
+a li\ne with \escapes
+backslash followed by a space \ $
+another split line\\\n
+;line 12
+end of test
+EOT
+
+AT_CHECK([fltst linecon decode read -- -i ';line' < input],
+[0],
+[expout])
+
+AT_CHECK([fltst linecon decode write -- -i ';line' < input],
+[0],
+[expout])
+
+AT_CLEANUP
+
 
 


hooks/post-receive
-- 
GNU Mailutils



reply via email to

[Prev in Thread] Current Thread [Next in Thread]