texinfo-commits
[Top][All Lists]
Advanced

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

[6584] first implementation of user-settable variables for colour, boldf


From: Gavin D. Smith
Subject: [6584] first implementation of user-settable variables for colour, boldface , blink etc.
Date: Sat, 29 Aug 2015 14:41:37 +0000

Revision: 6584
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6584
Author:   gavin
Date:     2015-08-29 14:41:35 +0000 (Sat, 29 Aug 2015)
Log Message:
-----------
first implementation of user-settable variables for colour, boldface, blink etc.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/display.c
    trunk/info/display.h
    trunk/info/terminal.c
    trunk/info/terminal.h
    trunk/info/variables.c
    trunk/info/variables.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-08-27 18:49:48 UTC (rev 6583)
+++ trunk/ChangeLog     2015-08-29 14:41:35 UTC (rev 6584)
@@ -1,3 +1,35 @@
+2015-08-29  Gavin Smith  <address@hidden>
+
+       * info/variable.c (set_variable_to_value): Handle rendition
+       variables in user init file.
+       (info_variables): Add user variables "ref-rendition",
+       "hl-ref-rendition", "match-rendition".
+       * info/display.h (RENDITION): New type.  Remove superfluous 
+       "extern" modifers for function declarations.
+       * info/terminal.h
+       (COLOUR_MASK, COLOUR_BLACK, COLOUR_RED, COLOUR_GREEN)
+       (COLOUR_YELLOW, COLOUR_BLUE, COLOUR_MAGENTA, COLOUR_CYAN)
+       (COLOUR_WHITE, UNDERLINE_MASK, STANDOUT_MASK, BOLD_MASK)
+       (ZERO1_MASK, BLINK_MASK): New symbols.
+       * info/terminal.c (terminal_switch_rendition): New function.
+       (terminal_default_colour, terminal_set_colour)
+       (terminal_begin_blink, terminal_end_blink)
+       (terminal_begin_bold, terminal_end_bold): New functions used by
+       terminal_switch_rendition.
+       (term_AF, term_AB, term_op, term_md, term_mb, term_me): New variables.
+       (terminal_initialize_terminal): Set them.
+
+       * info/display.c (wrap_terminal_switch_rendition): New function, 
+       to wrap terminal_switch_rendition function.
+       (wrap_terminal_begin_standout, wrap_terminal_end_standout)
+       (wrap_terminal_begin_underline, wrap_terminal_end_underline): 
+       Remove.
+
+       (display_process_line): Instead of saying directly whether 
+       underline or standout need to be turned on or off, decide which 
+       sets of renditions should be in effect, the order of their 
+       priority, and call wrap_terminal_switch_rendition with them.
+
 2015-08-28  Gavin Smith  <address@hidden>
 
        * doc/texinfo.tex (\sortas): Use \ignorespaces.

Modified: trunk/info/display.c
===================================================================
--- trunk/info/display.c        2015-08-27 18:49:48 UTC (rev 6583)
+++ trunk/info/display.c        2015-08-29 14:41:35 UTC (rev 6584)
@@ -293,45 +293,41 @@
 #define COLLECT 1
 #define WRITEOUT 2 /* Values for writing_out global. */
 
+/* Combine rendition masks that are active, in order of priority,
+   then check what's currently active on the display, and output
+   the necessary codes to switch.  The list of rendition masks is
+   the complete information about what the style should now be.
+   RENDITION3 takes priority over RENDITION2, which in turn takes
+   priority over RENDITION1. */
 static void
-wrap_terminal_begin_standout (struct text_buffer *printed_line)
+wrap_terminal_switch_rendition (struct text_buffer *printed_line,
+                                 RENDITION rendition1,
+                                 RENDITION rendition2,
+                                 RENDITION rendition3)
 {
-  if (writing_out == WRITEOUT)
-    terminal_begin_standout ();
-  else /* writing_out == COLLECT */
-    /* Add marker to string to record that standout starts here.  The text
-       added here, and in the other functions, is not output to the terminal, 
-       and is only used internally.  */
-    text_buffer_add_string (printed_line, "\033so", 3);
-}
+  long int desired_rendition = 0;
+  desired_rendition = rendition1.value;
+  desired_rendition &= ~rendition2.mask;
+  desired_rendition |= rendition2.value;
+  desired_rendition &= ~rendition3.mask;
+  desired_rendition |= rendition3.value;
 
-static void
-wrap_terminal_end_standout (struct text_buffer *printed_line)
-{
   if (writing_out == WRITEOUT)
-    terminal_end_standout ();
+    terminal_switch_rendition (desired_rendition);
   else
-    text_buffer_add_string (printed_line, "\033se", 3);
-}
+    {
+      /* Guarantee that each byte is non-zero, by having at least one
+         non-zero bit in it.  See ZERO1_MASK symbol in display.c. */
+      desired_rendition = ~desired_rendition;
 
-static void
-wrap_terminal_begin_underline (struct text_buffer *printed_line)
-{
-  if (writing_out == WRITEOUT)
-    terminal_begin_underline ();
-  else
-    text_buffer_add_string (printed_line, "\033us", 3);
+      /* The text added here is only used internally to see when the
+         display has changed, and is not output to the terminal. */
+      text_buffer_add_string (printed_line, "\033", 1);
+      text_buffer_add_string (printed_line, &desired_rendition,
+                              sizeof (long));
+    }
 }
 
-static void
-wrap_terminal_end_underline (struct text_buffer *printed_line)
-{
-  if (writing_out == WRITEOUT)
-    terminal_end_underline ();
-  else
-    text_buffer_add_string (printed_line, "\033ue", 3);
-}
-
 /* Set in display_update_node_text if matches or references are to be 
    distinguished with terminal appearance modes. */
 static regmatch_t *matches;
@@ -348,6 +344,11 @@
 
 static int pl_num; /* Number of printed lines done so far. */
 
+RENDITION ref_rendition = {0, 0};
+RENDITION hl_ref_rendition = {0, 0};
+RENDITION match_rendition = {0, 0};
+
+
 /* Process a line from the node in WIN starting at ITER, and advancing ITER
    to the end of the line.  What is done with the line depends on the value
    of WRITING_OUT.
@@ -363,11 +364,10 @@
   size_t pchars = 0; /* Printed chars */
   size_t pbytes = 0; /* Bytes to output. */
   char *rep;
-  int in_match = 0, in_ref = 0;
+  int in_match = 0;
+  int in_ref = 0, in_ref_proper = 0;
+  RENDITION empty = {0, 0};
 
-  /* Set to 1 when we are in the text of a cross-reference and at the start 
-     of a new line, and haven't seen a non-whitespace character yet. */
-  int ref_leading_whitespace = 1;
   int point_in_line;
 
   if (win->point >= win->line_starts[win->pagetop + pl_num]
@@ -380,19 +380,13 @@
 
   while (1)
     {
+      int was_in_ref_proper = in_ref_proper;
+      int was_in_match = in_match;
+
       if (!mbi_avail (iter))
         break;
       cur_ptr = mbi_cur_ptr (iter);
 
-      if (ref_leading_whitespace && !strchr (" \t", *cur_ptr))
-        {
-          ref_leading_whitespace = 0;
-          if (in_ref)
-            wrap_terminal_begin_underline (tb_printed_line);
-          if (!in_match && ref_highlighted)
-            wrap_terminal_begin_standout (tb_printed_line);
-        }
-
       if (matches && match_index != win->match_count)
         {
           int was_in_match = in_match;
@@ -400,14 +394,8 @@
                               &in_match, matches, win->match_count,
                               &match_index);
 
-          if (was_in_match && !in_match && !ref_highlighted)
-            wrap_terminal_end_standout (tb_printed_line);
-          else if (!was_in_match && in_match)
-            {
-              if (writing_out == DEFAULT)
-                writing_out = COLLECT;
-              wrap_terminal_begin_standout (tb_printed_line);
-            }
+          if (!was_in_match && in_match && writing_out == DEFAULT)
+            writing_out = COLLECT;
         }
 
       if (refs && refs[ref_index])
@@ -418,13 +406,7 @@
 
           if (was_in_ref && !in_ref)
             {
-              ref_leading_whitespace = 0;
-              wrap_terminal_end_underline (tb_printed_line);
-              if (ref_highlighted && !in_match)
-                {
-                  ref_highlighted = 0;
-                  wrap_terminal_end_standout (tb_printed_line);
-                }
+              in_ref_proper = ref_highlighted = 0;
             }
           else if (!was_in_ref && in_ref)
             {
@@ -472,17 +454,33 @@
                      no other reference follows it in the line. */
                   ref_highlighted = 1;
                 }
+            }
+        }
 
-              if (!ref_leading_whitespace)
-                {
-                  wrap_terminal_begin_underline (tb_printed_line);
-                  if (ref_highlighted)
-                    {
-                      wrap_terminal_begin_standout (tb_printed_line);
-                      point_in_line = 0;
-                    }
-                }
+      if (in_ref && !in_ref_proper && !strchr (" \t", *cur_ptr))
+        in_ref_proper = 1;
+
+      if (was_in_ref_proper != in_ref_proper || was_in_match != in_match)
+        {
+          /* Calculate the new rendition for output characters, and call
+             the function to switch to it. */
+          RENDITION ref = {0, 0};
+          RENDITION match = {0, 0};
+
+          if (in_ref_proper)
+            ref = ref_highlighted? hl_ref_rendition : ref_rendition;
+          if (in_match)
+            match = match_rendition;
+          if (!ref_highlighted)
+            {
+              wrap_terminal_switch_rendition (tb_printed_line,
+                                              ref, match, empty);
             }
+          else
+            {
+              wrap_terminal_switch_rendition (tb_printed_line,
+                                              match, ref, empty);
+            }
         }
 
       rep = printed_representation (&iter, delim, pl_chars,
@@ -505,10 +503,7 @@
       mbi_advance (iter);
     }
 
-  if (in_ref)
-    wrap_terminal_end_underline (tb_printed_line);
-  if (ref_highlighted || in_match)
-    wrap_terminal_end_standout (tb_printed_line);
+  wrap_terminal_switch_rendition (tb_printed_line, empty, empty, empty);
 
   *iter_inout = iter;
 }

Modified: trunk/info/display.h
===================================================================
--- trunk/info/display.h        2015-08-27 18:49:48 UTC (rev 6583)
+++ trunk/info/display.h        2015-08-29 14:41:35 UTC (rev 6584)
@@ -1,7 +1,7 @@
 /* display.h -- How the display in Info is done.
    $Id$
 
-   Copyright 1993, 1997, 2004, 2007, 2008, 2011, 2012, 2013, 2014
+   Copyright 1993, 1997, 2004, 2007, 2008, 2011, 2012, 2013, 2014, 2015
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -43,33 +43,42 @@
 extern int display_was_interrupted_p;
 
 /* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */
-extern void display_initialize_display (int width, int height);
+void display_initialize_display (int width, int height);
 
 /* Clear all of the lines in DISPLAY making the screen blank. */
-extern void display_clear_display (DISPLAY_LINE **display);
+void display_clear_display (DISPLAY_LINE **display);
 
 /* Update the windows on the display. */
-extern void display_update_display (void);
+void display_update_display (void);
 
 /* Display WIN on THE_DISPLAY.  Unlike display_update_display (), this
    function only does one window. */
-extern void display_update_one_window (WINDOW *win);
+void display_update_one_window (WINDOW *win);
 
 /* Move the screen cursor to directly over the current character in WINDOW. */
-extern void display_cursor_at_point (WINDOW *window);
+void display_cursor_at_point (WINDOW *window);
 
 /* Scroll the region of the_display starting at START, ending at END, and
    moving the lines AMOUNT lines.  If AMOUNT is less than zero, the lines
    are moved up in the screen, otherwise down.  Actually, it is possible
    for no scrolling to take place in the case that the terminal doesn't
    support it.  This doesn't matter to us. */
-extern void display_scroll_display (int start, int end, int amount);
+void display_scroll_display (int start, int end, int amount);
 
 /* Try to scroll lines in WINDOW.  OLD_PAGETOP is the pagetop of WINDOW before
    having had its line starts recalculated.  OLD_STARTS is the list of line
    starts that used to appear in this window.  OLD_COUNT is the number of lines
    that appear in the OLD_STARTS array. */
-extern void display_scroll_line_starts (WINDOW *window, int old_pagetop,
+void display_scroll_line_starts (WINDOW *window, int old_pagetop,
     long *old_starts, int old_count);
 
+typedef struct {
+    unsigned long mask;
+    unsigned long value;
+} RENDITION;
+
+extern RENDITION ref_rendition;
+extern RENDITION hl_ref_rendition;
+extern RENDITION match_rendition;
+
 #endif /* not INFO_DISPLAY_H */

Modified: trunk/info/terminal.c
===================================================================
--- trunk/info/terminal.c       2015-08-27 18:49:48 UTC (rev 6583)
+++ trunk/info/terminal.c       2015-08-29 14:41:35 UTC (rev 6584)
@@ -2,7 +2,7 @@
    $Id$
 
    Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 1998,
-   1999, 2001, 2002, 2004, 2007, 2008, 2012, 2013, 2014
+   1999, 2001, 2002, 2004, 2007, 2008, 2012, 2013, 2014, 2015
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -62,6 +62,10 @@
 VFunction *terminal_end_standout_hook = NULL;
 VFunction *terminal_begin_underline_hook = NULL;
 VFunction *terminal_end_underline_hook = NULL;
+VFunction *terminal_begin_bold_hook = NULL;
+VFunction *terminal_end_bold_hook = NULL;
+VFunction *terminal_begin_blink_hook = NULL;
+VFunction *terminal_end_blink_hook = NULL;
 VFunction *terminal_prep_terminal_hook = NULL;
 VFunction *terminal_unprep_terminal_hook = NULL;
 VFunction *terminal_up_line_hook = NULL;
@@ -132,6 +136,23 @@
 /* Strings entering and leaving underline mode. */
 char *term_us, *term_ue;
 
+/* Set foreground and background colours (terminfo setaf and setab) */
+char *term_AF, *term_AB;
+
+/* Restore original colours, both foreground and background.
+   ("original pair") */
+char *term_op;
+
+/* Turn on bold mode. */
+char *term_md;
+
+/* Turn on blink mode. */
+char *term_mb;
+
+/* Exit all attribute modes. */
+char *term_me;
+
+
 /* Although I can't find any documentation that says this is supposed to
    return its argument, all the code I've looked at (termutils, less)
    does so, so fine.  */
@@ -422,6 +443,50 @@
     }
 }
 
+void
+terminal_begin_bold (void)
+{
+  if (terminal_begin_bold_hook)
+    (*terminal_begin_bold_hook) ();
+  else
+    {
+      send_to_terminal (term_md);
+    }
+}
+
+void
+terminal_end_bold (void)
+{
+  if (terminal_end_bold_hook)
+    (*terminal_end_bold_hook) ();
+  else
+    {
+      send_to_terminal (term_me); /* FIXME - this turns off too much */
+    }
+}
+
+void
+terminal_begin_blink (void)
+{
+  if (terminal_begin_blink_hook)
+    (*terminal_begin_underline_hook) ();
+  else
+    {
+      send_to_terminal (term_mb);
+    }
+}
+
+void
+terminal_end_blink (void)
+{
+  if (terminal_end_blink_hook)
+    (*terminal_end_blink_hook) ();
+  else
+    {
+      send_to_terminal (term_me); /* FIXME */
+    }
+}
+
 /* Ring the terminal bell.  The bell is run visibly if it both has one and
    terminal_use_visible_bell_p is non-zero. */
 void
@@ -549,6 +614,75 @@
     }
 }
 
+/* Revert to the default foreground and background colours. */
+static void
+terminal_default_colour (void)
+{
+  tputs (term_op, 0, output_character_function);
+}
+
+static void
+terminal_set_colour (int colour)
+{
+  tputs (tgoto (term_AF, 0, colour), 0, output_character_function);
+}
+
+/* Information about what styles like colour, underlining, boldface are
+   currently output for text on the screen.  All zero represents the default
+   rendition. */
+static unsigned long terminal_rendition;
+
+void
+terminal_switch_rendition (unsigned long new)
+{
+  unsigned long old = terminal_rendition;
+  if ((new & COLOUR_MASK) != (old & COLOUR_MASK))
+    {
+      /* Switch colour. */
+      if ((new & COLOUR_MASK) == 00)
+        {
+          terminal_default_colour ();
+          /* Once we do the background colour as well, we should
+             record that the background colour has been reset. */
+        }
+      else if ((new & COLOUR_MASK) >= 8)
+        {
+          terminal_set_colour ((new & COLOUR_MASK - 8));
+        }
+      /* Colour values from 1 to 7 don't do anything right now. */
+    }
+  if ((new & UNDERLINE_MASK) != (old & UNDERLINE_MASK))
+    {
+      if ((new & UNDERLINE_MASK))
+        terminal_begin_underline ();
+      else
+        terminal_end_underline ();
+    }
+  if ((new & STANDOUT_MASK) != (old & STANDOUT_MASK))
+    {
+      if ((new & STANDOUT_MASK))
+        terminal_begin_standout ();
+      else
+        terminal_end_standout ();
+    }
+  if ((new & BOLD_MASK) != (old & BOLD_MASK))
+    {
+      if ((new & BOLD_MASK))
+        terminal_begin_bold ();
+      else
+        terminal_end_bold ();
+    }
+  if ((new & BLINK_MASK) != (old & BLINK_MASK))
+    {
+      if ((new & BLINK_MASK))
+        terminal_begin_blink ();
+      else
+        terminal_end_blink ();
+    }
+  terminal_rendition = new;
+}
+
+
 /* Re-initialize the terminal considering that the TERM/TERMCAP variable
    has changed. */
 void
@@ -590,8 +724,6 @@
       /* Environment variable COLUMNS overrides setting of "co". */
       if (screenwidth <= 0)
         {
-          char *sw = getenv ("COLUMNS");
-
           if (env_columns)
             screenwidth = atoi (env_columns);
 
@@ -860,6 +992,21 @@
   else
     term_ue = NULL;
 
+  term_AF = tgetstr ("AF", &buffer);
+  if (term_AF)
+    term_AB = tgetstr ("AB", &buffer);
+  else
+    term_AB = NULL;
+
+  term_op = tgetstr ("op", &buffer);
+
+  term_md = tgetstr ("md", &buffer);
+  term_mb = tgetstr ("mb", &buffer);
+
+  term_me = tgetstr ("me", &buffer);
+  if (!term_me)
+    term_md = 0; /* Don't use modes if we can't turn them off. */
+
   if (!term_cr)
     term_cr =  "\r";
 

Modified: trunk/info/terminal.h
===================================================================
--- trunk/info/terminal.h       2015-08-27 18:49:48 UTC (rev 6583)
+++ trunk/info/terminal.h       2015-08-29 14:41:35 UTC (rev 6584)
@@ -1,7 +1,7 @@
 /* terminal.h -- The external interface to terminal I/O.
    $Id$
 
-   Copyright 1993, 1996, 1997, 2001, 2002, 2004, 2007, 2013, 2014
+   Copyright 1993, 1996, 1997, 2001, 2002, 2004, 2007, 2013, 2014, 2015
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -151,4 +151,27 @@
 #define MP_NORMAL_TRACKING 1
 extern int mouse_protocol;
 
+#define COLOUR_MASK             000000000017
+#define COLOUR_BLACK    8 + 0
+#define COLOUR_RED      8 + 1
+#define COLOUR_GREEN    8 + 2
+#define COLOUR_YELLOW   8 + 3
+#define COLOUR_BLUE     8 + 4
+#define COLOUR_MAGENTA  8 + 5
+#define COLOUR_CYAN     8 + 6
+#define COLOUR_WHITE    8 + 7
+#define UNDERLINE_MASK          000000000020
+#define STANDOUT_MASK           000000000040
+#define BOLD_MASK               000000000100
+#define ZERO1_MASK              000000000200
+#define BLINK_MASK              000000000400
+#define ZERO2_MASK              000000100000
+#define ZERO3_MASK              000040000000
+#define ZERO4_MASK              020000000000
+
+/* ZEROi_MASK are always zero bits. */
+
+void terminal_switch_rendition (unsigned long desired_rendition);
+
+
 #endif /* !TERMINAL_H */

Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c      2015-08-27 18:49:48 UTC (rev 6583)
+++ trunk/info/variables.c      2015-08-29 14:41:35 UTC (rev 6584)
@@ -2,7 +2,7 @@
    $Id$
 
    Copyright 1993, 1997, 2001, 2002, 2004, 2007, 2008, 2011, 2013,
-   2014 Free Software Foundation, Inc.
+   2014, 2015 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,6 +23,8 @@
 #include "session.h"
 #include "echo-area.h"
 #include "variables.h"
+#include "terminal.h"
+#include "display.h"
 
 /* **************************************************************** */
 /*                                                                  */
@@ -46,6 +48,12 @@
 /* Choices for the scroll-last-node variable */
 static char *scroll_last_node_choices[] = { "Stop", "Top", NULL };
 
+/* Set choices to address of this to indicate takes a value in the
+   format for specifying renditions.  Nothing is actually stored in
+   this variable. */
+char *rendition_variable = 0;
+
+
 /* Note that the 'where_set' field of each element in the array is
    not given and defaults to 0. */
 VARIABLE_ALIST info_variables[] = {
@@ -134,9 +142,22 @@
       N_("How to follow a cross-reference"),
     &follow_strategy, (char **)follow_strategy_choices },
 
+  { "ref-rendition",
+      N_("Styles for links"),
+    &ref_rendition, &rendition_variable },
+
+  { "hl-ref-rendition",
+      N_("Styles for active links"),
+    &hl_ref_rendition, &rendition_variable },
+
+  { "match-rendition",
+      N_("Styles for search matches"),
+    &match_rendition, &rendition_variable },
+
   { NULL }
 };
 
+
 DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable"))
 {
   VARIABLE_ALIST *var;
@@ -315,6 +336,9 @@
   return array;
 }
 
+/* VALUE is a string that is the value of the variable specified
+   by the user.  Update our internal data structure VAR using this
+   information. */
 int
 set_variable_to_value (VARIABLE_ALIST *var, char *value, int where)
 {
@@ -326,15 +350,75 @@
   if (var->choices)
     {
       register int j;
-      
-      /* Find the choice in our list of choices. */
-      for (j = 0; var->choices[j]; j++)
-       if (strcmp (var->choices[j], value) == 0)
-         {
-           *var->value = j;
-            var->where_set = where;
-           return 1;
-         }
+
+      if (var->choices != &rendition_variable)
+        {
+          /* Find the choice in our list of choices. */
+          for (j = 0; var->choices[j]; j++)
+            if (strcmp (var->choices[j], value) == 0)
+              {
+                *var->value = j;
+                var->where_set = where;
+                return 1;
+              }
+        }
+      else
+        {
+          static struct {
+              unsigned long mask;
+              unsigned long value;
+              char *name;
+          } styles[] = {
+              COLOUR_MASK, COLOUR_BLACK,   "black",
+              COLOUR_MASK, COLOUR_RED,     "red",
+              COLOUR_MASK, COLOUR_GREEN,   "green",
+              COLOUR_MASK, COLOUR_YELLOW,  "yellow",
+              COLOUR_MASK, COLOUR_BLUE,    "blue",
+              COLOUR_MASK, COLOUR_MAGENTA, "magenta",
+              COLOUR_MASK, COLOUR_CYAN,    "cyan",
+              COLOUR_MASK, COLOUR_WHITE,   "white",
+              COLOUR_MASK, 0,           "nocolour",
+              COLOUR_MASK, 0,           "nocolor",
+              UNDERLINE_MASK, UNDERLINE_MASK, "underline",
+              UNDERLINE_MASK, 0,              "nounderline",
+              STANDOUT_MASK, STANDOUT_MASK, "standout",
+              STANDOUT_MASK, 0,             "nostandout",
+              BOLD_MASK, BOLD_MASK,         "bold",
+              BOLD_MASK, 0,                 "regular",
+              BOLD_MASK, 0,                 "nobold",
+              BLINK_MASK, BLINK_MASK,       "blink",
+              BLINK_MASK, 0,                "noblink",
+          };
+          int i;
+          char *component;
+          unsigned long rendition_mask = 0;
+          unsigned long rendition_value = 0;
+
+          component = strtok (value, ",");
+          while (component)
+            {
+              for (i = 0; (styles[i].name); i++)
+                {
+                  if (!strcmp (styles[i].name, component))
+                    break;
+                }
+              if (styles[i].name)
+                {
+                  rendition_mask |= styles[i].mask;
+                  rendition_value &= ~styles[i].mask;
+                  rendition_value |= styles[i].value;
+                }
+              /* If not found, silently ignore, in case more options are
+                 added in the future. */
+
+              component = strtok (0, ",");
+            }
+
+          /* Now all the specified styles are recorded in rendition_value. */
+          ((RENDITION *)var->value)->mask = rendition_mask;
+          ((RENDITION *)var->value)->value = rendition_value;
+        }
+      return 1;
     }
   else
     {

Modified: trunk/info/variables.h
===================================================================
--- trunk/info/variables.h      2015-08-27 18:49:48 UTC (rev 6583)
+++ trunk/info/variables.h      2015-08-29 14:41:35 UTC (rev 6584)
@@ -1,7 +1,7 @@
 /* variables.h -- Description of user visible variables in Info.
    $Id$
 
-   Copyright 1993, 1997, 2004, 2007, 2011, 2013, 2014
+   Copyright 1993, 1997, 2004, 2007, 2011, 2013, 2014, 2015
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify




reply via email to

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