bug-texinfo
[Top][All Lists]
Advanced

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

@hsep, @vsep and some fixes


From: Yamate Keiichirou
Subject: @hsep, @vsep and some fixes
Date: Sat, 01 Jun 2002 21:36:02 +0900

  This patch fixes some undesirable format at HTML and Info as folloing:

   o  In Info, columns widths in same column in @multitable differs
     with @hsep.
   o  In HTML, @hsep, @vsep, and any column widths definition are
     ignored.
   o  In HTML, space characters in anchor name are escaped with HTTP
     manner ("%xxx", xxx is character code#), but officialy, name
     attribute should be escaped only with HTML manner ("&yyy;", yyy
     is character name or code#), because name attributes are not
     parsed in HTTP engine. What I know to be affected is only some
     versions of mozilla/.

  and some new functions written.

   o  @tabhspan and @tabvspan are defined for INFO and HTML. They
     joint columns horizontally/vertically.
   o Alphabet index in @enumerate is enhanced, as "x, y, z, aa,
     ab ..."

  Patch for version 4.2 and sample .texi is in this mail.
----
yamate

diff -rC8 texinfo-4.2/makeinfo/cmds.c texinfo-4.2-own/makeinfo/cmds.c
*** texinfo-4.2/makeinfo/cmds.c Fri Mar 29 01:35:29 2002
--- texinfo-4.2-own/makeinfo/cmds.c     Sun May 26 19:31:40 2002
***************
*** 50,65 ****
--- 50,66 ----
    cm_verb (), cm_copying (), cm_insert_copying (),
    cm_documentdescription ();
  
  void
    cm_anchor (), cm_node (), cm_menu (), cm_xref (), cm_ftable (),
    cm_vtable (), cm_pxref (), cm_inforef (), cm_uref (), cm_email (),
    cm_quotation (), cm_display (), cm_smalldisplay (), cm_itemize (),
    cm_enumerate (), cm_tab (), cm_table (), cm_itemx (), cm_noindent (),
+   cm_tabhspan (), cm_tabvspan (),
    cm_setfilename (), cm_br (), cm_sp (), cm_page (), cm_group (),
    cm_center (), cm_ref (), cm_include (), cm_bye (), cm_item (), cm_end (),
    cm_kindex (), cm_cindex (), cm_findex (), cm_pindex (), cm_vindex (),
    cm_tindex (), cm_synindex (), cm_printindex (), cm_minus (),
    cm_example (), cm_smallexample (), cm_smalllisp (), cm_lisp (),
    cm_format (), cm_smallformat (), cm_exdent (), cm_defindex (),
    cm_defcodeindex (), cm_result (), cm_expansion (), cm_equiv (),
    cm_print (), cm_error (), cm_point (), cm_today (), cm_flushleft (),
***************
*** 313,329 ****
--- 314,332 ----
    { "subsection", cm_subsection, NO_BRACE_ARGS },
    { "subsubheading", cm_subsubheading, NO_BRACE_ARGS },
    { "subsubsection", cm_subsubsection, NO_BRACE_ARGS },
    { "summarycontents", cm_shortcontents, NO_BRACE_ARGS },
    { "syncodeindex", cm_synindex, NO_BRACE_ARGS },
    { "synindex", cm_synindex, NO_BRACE_ARGS },
    { "t", cm_tt, BRACE_ARGS },
    { "tab", cm_tab, NO_BRACE_ARGS },
+   { "tabhspan", cm_tabhspan, NO_BRACE_ARGS },
    { "table", cm_table, NO_BRACE_ARGS },
+   { "tabvspan", cm_tabvspan, NO_BRACE_ARGS },
    { "tex", cm_tex, NO_BRACE_ARGS },
    { "tieaccent", cm_accent, MAYBE_BRACE_ARGS },
    { "tindex", cm_tindex, NO_BRACE_ARGS },
    { "titlefont", cm_titlefont, BRACE_ARGS },
    { "titlepage", command_name_condition, NO_BRACE_ARGS },
    { "today", cm_today, BRACE_ARGS },
    { "top", cm_top, NO_BRACE_ARGS  },
    { "u", cm_accent, MAYBE_BRACE_ARGS },
diff -rC8 texinfo-4.2/makeinfo/html.c texinfo-4.2-own/makeinfo/html.c
*** texinfo-4.2/makeinfo/html.c Mon Apr  1 23:03:36 2002
--- texinfo-4.2-own/makeinfo/html.c     Mon May 27 23:13:22 2002
***************
*** 169,194 ****
        add_word_args ("%s", attributes);
        add_word_args (" href=\"");
        add_anchor_name (nodename, 1);
        add_word ("\"></a>\n");
      }
  }
  
  /* Output NAME with characters escaped as appropriate for an anchor
!    name, i.e., escape URL special characters as %<n>.  */
  void
! add_escaped_anchor_name (name)
       char *name;
  {
    for (; *name; name++)
      {
        if (*name == '&')
          add_word ("&amp;");
!       else if (! URL_SAFE_CHAR (*name))
          /* Cast so characters with the high bit set are treated as >128,
             for example o-umlaut should be 246, not -10.  */
          add_word_args ("%%%x", (unsigned char) *name);
        else
          add_char (*name);
      }
  }
  
--- 169,197 ----
        add_word_args ("%s", attributes);
        add_word_args (" href=\"");
        add_anchor_name (nodename, 1);
        add_word ("\"></a>\n");
      }
  }
  
  /* Output NAME with characters escaped as appropriate for an anchor
!    name, i.e., escaped HTML characters as &...;.  Note: translate
!    escape HTTP special characters as %<n> only when output for href
!    only, because name/id attributes are parsed only in HTML but HTTP.  */
  void
! add_escaped_anchor_name (name, href)
       char *name;
+      int href;
  {
    for (; *name; name++)
      {
        if (*name == '&')
          add_word ("&amp;");
!       else if (href && ! URL_SAFE_CHAR (*name))
          /* Cast so characters with the high bit set are treated as >128,
             for example o-umlaut should be 246, not -10.  */
          add_word_args ("%%%x", (unsigned char) *name);
        else
          add_char (*name);
      }
  }
  
***************
*** 210,226 ****
    /* Always add NODENAME, so that the reference would pinpoint the
       exact node on its file.  This is so several nodes could share the
       same file, in case of file-name clashes, but also for more
       accurate browser positioning.  */
    if (strcasecmp (nodename, "(dir)") == 0)
      /* Strip the parens, but keep the original letter-case.  */
      add_word_args ("%.3s", nodename + 1);
    else
!     add_escaped_anchor_name (nodename);
  }
  
  /* Insert the text for the name of a reference in an HTML url, aprropriate
     for NODENAME */
  void
  add_url_name (nodename, href)
       char *nodename;
       int href;
--- 213,229 ----
    /* Always add NODENAME, so that the reference would pinpoint the
       exact node on its file.  This is so several nodes could share the
       same file, in case of file-name clashes, but also for more
       accurate browser positioning.  */
    if (strcasecmp (nodename, "(dir)") == 0)
      /* Strip the parens, but keep the original letter-case.  */
      add_word_args ("%.3s", nodename + 1);
    else
!     add_escaped_anchor_name (nodename, href);
  }
  
  /* Insert the text for the name of a reference in an HTML url, aprropriate
     for NODENAME */
  void
  add_url_name (nodename, href)
       char *nodename;
       int href;
diff -rC8 texinfo-4.2/makeinfo/html.h texinfo-4.2-own/makeinfo/html.h
*** texinfo-4.2/makeinfo/html.h Tue Mar 19 04:45:18 2002
--- texinfo-4.2-own/makeinfo/html.h     Mon May 27 23:13:37 2002
***************
*** 31,47 ****
  
  /* Open or close TAG according to START_OR_END.  */
  extern void insert_html_tag (/* int start_or_end, char *tag */);
  
  /* Output HTML <link> to NODE, plus extra ATTRIBUTES.  */
  extern void add_link (/* char *node, char *attributes */);
  
  /* Escape URL-special characters as %xy.  */
! extern void add_escaped_anchor_name (/* char *name */);
  
  /* See html.c.  */
  extern void add_anchor_name (/* nodename, href */);
  extern void add_url_name ( /* nodename, href */ );
  extern char* nodename_to_filename ( /* nodename */ );
  extern void add_nodename_to_filename ( /*nodename, href */ );
  
  #endif /* !HTML_H */
--- 31,47 ----
  
  /* Open or close TAG according to START_OR_END.  */
  extern void insert_html_tag (/* int start_or_end, char *tag */);
  
  /* Output HTML <link> to NODE, plus extra ATTRIBUTES.  */
  extern void add_link (/* char *node, char *attributes */);
  
  /* Escape URL-special characters as %xy.  */
! extern void add_escaped_anchor_name (/* char *name, int href */);
  
  /* See html.c.  */
  extern void add_anchor_name (/* nodename, href */);
  extern void add_url_name ( /* nodename, href */ );
  extern char* nodename_to_filename ( /* nodename */ );
  extern void add_nodename_to_filename ( /*nodename, href */ );
  
  #endif /* !HTML_H */
*** texinfo-4.2/makeinfo/insertion.c    Mon Apr  1 23:01:36 2002
--- texinfo-4.2-own/makeinfo/insertion.c        Mon May 27 23:19:40 2002
***************
*** 244,261 ****
       || (type == defvr)
    ;
  }
  
  /* MAX_NS is the maximum nesting level for enumerations.  I picked 100
     which seemed reasonable.  This doesn't control the number of items,
     just the number of nested lists. */
  #define max_stack_depth 100
! #define ENUM_DIGITS 1
! #define ENUM_ALPHA  2
  typedef struct {
    int enumtype;
    int enumval;
  } DIGIT_ALPHA;
  
  DIGIT_ALPHA enumstack[max_stack_depth];
  int enumstack_offset = 0;
  int current_enumval = 1;
--- 244,262 ----
       || (type == defvr)
    ;
  }
  
  /* MAX_NS is the maximum nesting level for enumerations.  I picked 100
     which seemed reasonable.  This doesn't control the number of items,
     just the number of nested lists. */
  #define max_stack_depth 100
! #define ENUM_DIGITS    1
! #define ENUM_LOWER_ALPHA 2
! #define ENUM_UPPER_ALPHA 3
  typedef struct {
    int enumtype;
    int enumval;
  } DIGIT_ALPHA;
  
  DIGIT_ALPHA enumstack[max_stack_depth];
  int enumstack_offset = 0;
  int current_enumval = 1;
***************
*** 268,283 ****
--- 269,285 ----
  {
    if ((enumstack_offset + 1) == max_stack_depth)
      {
        line_error (_("Enumeration stack overflow"));
        return;
      }
    enumstack[enumstack_offset].enumtype = current_enumtype;
    enumstack[enumstack_offset].enumval = current_enumval;
+ 
    enumstack_offset++;
    current_enumval = at;
    current_enumtype = type;
  }
  
  void
  stop_enumerating ()
  {
***************
*** 289,319 ****
    current_enumtype = enumstack[enumstack_offset].enumtype;
  }
  
  /* Place a letter or digits into the output stream. */
  void
  enumerate_item ()
  {
    char temp[10];
  
!   if (current_enumtype == ENUM_ALPHA)
      {
!       if (current_enumval == ('z' + 1) || current_enumval == ('Z' + 1))
!         {
!           current_enumval = ((current_enumval - 1) == 'z' ? 'a' : 'A');
!           warning (_("lettering overflow, restarting at %c"), 
current_enumval);
!         }
!       sprintf (temp, "%c. ", current_enumval);
      }
-   else
-     sprintf (temp, "%d. ", current_enumval);
  
!   indent (output_column += (current_indent - strlen (temp)));
!   add_word (temp);
    current_enumval++;
  }
  
  static void
  enum_html ()
  {
    char type;
    int start;
--- 291,347 ----
    current_enumtype = enumstack[enumstack_offset].enumtype;
  }
  
  /* Place a letter or digits into the output stream. */
  void
  enumerate_item ()
  {
    char temp[10];
+   int i = 0;
+   int tempval = current_enumval;
  
!   switch (current_enumtype)
      {
!     default:
!     case ENUM_DIGITS:
!       sprintf (temp, "%d. ", current_enumval);
!       break;
! 
!     case ENUM_UPPER_ALPHA:
!       temp[9] = '\0';
!       temp[8] = ' ';
!       temp[7] = '.';
!       i = 7;
!       while (tempval)
!       {
!         i --;
!         tempval --;
!         temp[i] = (tempval % 26) + 'A';
!         tempval /= 26;
!       }
!       break;
! 
!     case ENUM_LOWER_ALPHA:
!       temp[9] = '\0';
!       temp[8] = ' ';
!       temp[7] = '.';
!       i = 7;
!       while (tempval)
!       {
!         i --;
!         tempval --;
!         temp[i] = (tempval % 26) + 'a';
!         tempval /= 26;
!       }
!       break;
      }
  
!   indent (output_column += (current_indent - strlen (temp + i)));
!   add_word (temp + i);
    current_enumval++;
  }
  
  static void
  enum_html ()
  {
    char type;
    int start;
***************
*** 568,585 ****
        if (html)
          enum_html ();
  
        if (xml)
        xml_begin_enumerate (enumeration_arg);
        
        if (isdigit (*enumeration_arg))
          start_enumerating (atoi (enumeration_arg), ENUM_DIGITS);
        else
!         start_enumerating (*enumeration_arg, ENUM_ALPHA);
        break;
  
        /* @group does nothing special in makeinfo. */
      case group:
        /* Only close the paragraph if we are not inside of an
           @example-like environment. */
        if (xml)
        xml_insert_element (GROUP, START);
--- 596,615 ----
        if (html)
          enum_html ();
  
        if (xml)
        xml_begin_enumerate (enumeration_arg);
        
        if (isdigit (*enumeration_arg))
          start_enumerating (atoi (enumeration_arg), ENUM_DIGITS);
+       else if (isupper (*enumeration_arg))
+         start_enumerating (*enumeration_arg - 'A' + 1, ENUM_UPPER_ALPHA);
        else
!         start_enumerating (*enumeration_arg - 'a' + 1, ENUM_LOWER_ALPHA);
        break;
  
        /* @group does nothing special in makeinfo. */
      case group:
        /* Only close the paragraph if we are not inside of an
           @example-like environment. */
        if (xml)
        xml_insert_element (GROUP, START);
diff -rC8 texinfo-4.2/makeinfo/macro.c texinfo-4.2-own/makeinfo/macro.c
*** texinfo-4.2/makeinfo/macro.c        Sun Mar  3 00:05:29 2002
--- texinfo-4.2-own/makeinfo/macro.c    Mon May 27 23:16:57 2002
***************
*** 74,90 ****
        int i;
        for (i = 0; array[i]; i++)
          free (array[i]);
  
        free (array);
      }
  }
  
! /* Return the macro definition of NAME or NULL if NAME is not defined. */
  MACRO_DEF *
  find_macro (name)
       char *name;
  {
    int i;
    MACRO_DEF *def;
  
    def = NULL;
--- 74,92 ----
        int i;
        for (i = 0; array[i]; i++)
          free (array[i]);
  
        free (array);
      }
  }
  
! /* Return the macro definition of NAME or NULL if NAME is not defined.
!    In texinfo of Texinfo, MACRONAME must consists only lettes, means
!    alphabets, but other letters, that are kinds of digits, glyphs. */
  MACRO_DEF *
  find_macro (name)
       char *name;
  {
    int i;
    MACRO_DEF *def;
  
    def = NULL;
diff -rC8 texinfo-4.2/makeinfo/multi.c texinfo-4.2-own/makeinfo/multi.c
*** texinfo-4.2/makeinfo/multi.c        Sat Jan 19 10:09:11 2002
--- texinfo-4.2-own/makeinfo/multi.c    Sun May 26 21:34:47 2002
***************
*** 30,46 ****
  /*
   * Output environments.  This is a hack grafted onto existing
   * structure.  The "output environment" used to consist of the
   * global variables `output_paragraph', `fill_column', etc.
   * Routines like add_char would manipulate these variables.
   *
   * Now, when formatting a multitable, we maintain separate environments
   * for each column.  That way we can build up the columns separately
!  * and write them all out at once.  The "current" output environment"
   * is still kept in those global variables, so that the old output
   * routines don't have to change.  But we provide routines to save
   * and restore these variables in an "environment table".  The
   * `select_output_environment' function switches from one output
   * environment to another.
   *
   * Environment #0 (i.e., element #0 of the table) is the regular
   * environment that is used when we're not formatting a multitable.
--- 30,46 ----
  /*
   * Output environments.  This is a hack grafted onto existing
   * structure.  The "output environment" used to consist of the
   * global variables `output_paragraph', `fill_column', etc.
   * Routines like add_char would manipulate these variables.
   *
   * Now, when formatting a multitable, we maintain separate environments
   * for each column.  That way we can build up the columns separately
!  * and write them all out at once.  The "current" output environment
   * is still kept in those global variables, so that the old output
   * routines don't have to change.  But we provide routines to save
   * and restore these variables in an "environment table".  The
   * `select_output_environment' function switches from one output
   * environment to another.
   *
   * Environment #0 (i.e., element #0 of the table) is the regular
   * environment that is used when we're not formatting a multitable.
***************
*** 54,78 ****
  struct env
  {
    unsigned char *output_paragraph;
    int output_paragraph_offset;
    int meta_char_pos;
    int output_column;
    int paragraph_is_open;
    int current_indent;
!   int fill_column;
  } envs[MAXCOLS];                /* the environment table */
  
  /* index in environment table of currently selected environment */
  static int current_env_no;
  
  /* column number of last column in current multitable */
  static int last_column;
  
  /* flags indicating whether horizontal and vertical separators need
     to be drawn, separating rows and columns in the current multitable. */
  static int hsep, vsep;
  
  /* whether this is the first row. */
  static int first_row;
  
  static void output_multitable_row ();
--- 54,92 ----
  struct env
  {
    unsigned char *output_paragraph;
    int output_paragraph_offset;
    int meta_char_pos;
    int output_column;
    int paragraph_is_open;
    int current_indent;
!   int fill_column;            /* current spaned column width */
!   int default_fill_column;    /* default colum width in the table */
!   int output_offset;          /* rowspaned columns offset to be output */
!   signed int joined_column;   /* #jointed columns with this */
!   signed int joined_row;      /* #jointed rows, minus means jointed. */
  } envs[MAXCOLS];                /* the environment table */
  
  /* index in environment table of currently selected environment */
  static int current_env_no;
  
  /* column number of last column in current multitable */
  static int last_column;
  
+ /* number of horizontaly jointed columns with this cell */
+ static signed int joined_column;
+ 
+ /* number of vertically jointed rows with this cell */
+ static signed int joined_row;
+ static int output_offset;
+ 
+ /* current default fill_column */
+ static int default_fill_column;
+ 
  /* flags indicating whether horizontal and vertical separators need
     to be drawn, separating rows and columns in the current multitable. */
  static int hsep, vsep;
  
  /* whether this is the first row. */
  static int first_row;
  
  static void output_multitable_row ();
***************
*** 83,154 ****
  static void
  out_char (ch)
      int ch;
  {
    if (html)
      add_char (ch);
    else
      {
-       int env = select_output_environment (0);
        insert (ch);
        if (ch == '\n')
        {
          uninhibit_output_flushing ();
          flush_output ();
          inhibit_output_flushing ();
        }
-       select_output_environment (env);
      }
  }
  
  
! void
  draw_horizontal_separator ()
  {
    int i, j, s;
  
-   if (html)
-     {
-       add_word ("<hr>");
-       return;
-     }
-   if (xml)
-     return;
- 
    for (s = 0; s < envs[0].current_indent; s++)
      out_char (' ');
    if (vsep)
      out_char ('+');
!   for (i = 1; i <= last_column; i++) {
!     for (j = 0; j <= envs[i].fill_column; j++)
        out_char ('-');
      if (vsep)
        out_char ('+');
    }
    out_char ('\n');
  }
  
  
  /* multitable strategy:
      for each item {
         for each column in an item {
          initialize a new paragraph
          do ordinary formatting into the new paragraph
          save the paragraph away
          repeat if there are more paragraphs in the column
        }
        dump out the saved paragraphs and free the storage
      }
! 
!    For HTML we construct a simple HTML 3.2 table with <br>s inserted
!    to help non-tables browsers.  address@hidden' inserts a <tr> and 
address@hidden'
!    inserts <td>; we also try to close <tr>.  The only real
!    alternative is to rely on the info formatting engine and present
!    preformatted text.  */
  
  void
  do_multitable ()
  {
    int ncolumns;
  
    if (multitable_active)
      {
--- 97,156 ----
  static void
  out_char (ch)
      int ch;
  {
    if (html)
      add_char (ch);
    else
      {
        insert (ch);
        if (ch == '\n')
        {
          uninhibit_output_flushing ();
          flush_output ();
          inhibit_output_flushing ();
        }
      }
  }
  
  
! static void
  draw_horizontal_separator ()
  {
    int i, j, s;
  
    for (s = 0; s < envs[0].current_indent; s++)
      out_char (' ');
    if (vsep)
      out_char ('+');
!   for (i = 1; i <= last_column;) {
!     for (j = 0; j < envs[i].default_fill_column; j++)
        out_char ('-');
      if (vsep)
        out_char ('+');
+     else
+       out_char ('-');
+     i++;
    }
    out_char ('\n');
  }
  
  
  /* multitable strategy:
      for each item {
         for each column in an item {
          initialize a new paragraph
          do ordinary formatting into the new paragraph
          save the paragraph away
          repeat if there are more paragraphs in the column
        }
        dump out the saved paragraphs and free the storage
      }
!     */
  
  void
  do_multitable ()
  {
    int ncolumns;
  
    if (multitable_active)
      {
***************
*** 158,193 ****
  
    close_single_paragraph ();
  
    /* scan the current item function to get the field widths
       and number of columns, and set up the output environment list
       accordingly. */
    /*  if (docbook)*/ /* 05-08 */
    if (xml)
!     xml_no_para = 1;
    ncolumns = setup_multitable_parameters ();
-   first_row = 1;
  
    /* <p> for non-tables browsers.  @multitable implicitly ends the
       current paragraph, so this is ok.  */
    if (html)
!     add_word ("<p><table>");
!   /*  else if (docbook)*/ /* 05-08 */
    else if (xml)
      {
        int *widths = xmalloc (ncolumns * sizeof (int));
        int i;
        for (i=0; i<ncolumns; i++)
        widths[i] = envs[i+1].fill_column;
        xml_begin_multitable (ncolumns, widths);
        free (widths);
      }
  
!   if (hsep)
      draw_horizontal_separator ();
  
    /* The next @item command will direct stdout into the first column
       and start processing.  @tab will then switch to the next column,
       and @item will flush out the saved output and return to the first
       column.  Environment #1 is the first column.  (Environment #0 is
       the normal output) */
  
--- 160,213 ----
  
    close_single_paragraph ();
  
    /* scan the current item function to get the field widths
       and number of columns, and set up the output environment list
       accordingly. */
    /*  if (docbook)*/ /* 05-08 */
    if (xml)
!     {
!       xml_no_para = 1;
!       first_row = 1;
!     }
    ncolumns = setup_multitable_parameters ();
  
    /* <p> for non-tables browsers.  @multitable implicitly ends the
       current paragraph, so this is ok.  */
    if (html)
!     {
!       add_word ("<p><table");
!       switch ((hsep ? 2 : 0) + (vsep ? 1 : 0)) {
!       case 3:
!       add_word(" border=1");
!       break;
!       case 2:
!       add_word(" border=1 rules=cols");
!       break;
!       case 1:
!       add_word(" border=1 rules=rows");
!       break;
!       default:
!       break;
!       }
!       add_word (">");
!     }
!   /*  else if (docbook) */ /* 05-08 */
    else if (xml)
      {
        int *widths = xmalloc (ncolumns * sizeof (int));
        int i;
        for (i=0; i<ncolumns; i++)
        widths[i] = envs[i+1].fill_column;
        xml_begin_multitable (ncolumns, widths);
        free (widths);
      }
  
!   if (!html && !xml && !docbook && hsep)
      draw_horizontal_separator ();
  
    /* The next @item command will direct stdout into the first column
       and start processing.  @tab will then switch to the next column,
       and @item will flush out the saved output and return to the first
       column.  Environment #1 is the first column.  (Environment #0 is
       the normal output) */
  
***************
*** 318,338 ****
     all out at the end. */
  int
  setup_output_environment (env_no, width)
      int env_no;
      int width;
  {
    int old_env = select_output_environment (env_no);
  
    /* clobber old environment and set width of new one */
    init_paragraph ();
! 
!   /* make our change */
!   fill_column = width;
  
    /* Save new environment and restore previous one. */
    select_output_environment (old_env);
  
    return env_no;
  }
  
  /* Direct current output to environment number N.  Used when
--- 338,363 ----
     all out at the end. */
  int
  setup_output_environment (env_no, width)
      int env_no;
      int width;
  {
    int old_env = select_output_environment (env_no);
  
+   /* set column width */
+   default_fill_column = fill_column = width;
+ 
+   /* reset joining cell range */
+   joined_column = 0;
+   joined_row = 0;
+ 
    /* clobber old environment and set width of new one */
    init_paragraph ();
!   output_offset = 0;
  
    /* Save new environment and restore previous one. */
    select_output_environment (old_env);
  
    return env_no;
  }
  
  /* Direct current output to environment number N.  Used when
***************
*** 348,386 ****
    /* stash current env info from global vars into the old environment */
    e->output_paragraph = output_paragraph;
    e->output_paragraph_offset = output_paragraph_offset;
    e->meta_char_pos = meta_char_pos;
    e->output_column = output_column;
    e->paragraph_is_open = paragraph_is_open;
    e->current_indent = current_indent;
    e->fill_column = fill_column;
  
    /* now copy new environment into global vars */
    current_env_no = n;
    e = &envs[current_env_no];
    output_paragraph = e->output_paragraph;
    output_paragraph_offset = e->output_paragraph_offset;
    meta_char_pos = e->meta_char_pos;
    output_column = e->output_column;
    paragraph_is_open = e->paragraph_is_open;
    current_indent = e->current_indent;
    fill_column = e->fill_column;
    return old_env_no;
  }
  
  /* advance to the next environment number */
  void
  nselect_next_environment ()
  {
!   if (current_env_no >= last_column) {
      line_error (_("Too many columns in multitable item (max %d)"), 
last_column);
      return;
    }
!   select_output_environment (current_env_no + 1);
  }
  
  
  /* do anything needed at the beginning of processing a
     multitable column. */
  void
  init_column ()
  {
--- 373,422 ----
    /* stash current env info from global vars into the old environment */
    e->output_paragraph = output_paragraph;
    e->output_paragraph_offset = output_paragraph_offset;
    e->meta_char_pos = meta_char_pos;
    e->output_column = output_column;
    e->paragraph_is_open = paragraph_is_open;
    e->current_indent = current_indent;
    e->fill_column = fill_column;
+   e->default_fill_column = default_fill_column;
+   e->output_offset = output_offset;
+   e->joined_column = joined_column;
+   e->joined_row = joined_row;
  
    /* now copy new environment into global vars */
    current_env_no = n;
    e = &envs[current_env_no];
    output_paragraph = e->output_paragraph;
    output_paragraph_offset = e->output_paragraph_offset;
    meta_char_pos = e->meta_char_pos;
    output_column = e->output_column;
    paragraph_is_open = e->paragraph_is_open;
    current_indent = e->current_indent;
    fill_column = e->fill_column;
+   default_fill_column = e->default_fill_column;
+   output_offset = e->output_offset;
+   joined_column = e->joined_column;
+   joined_row = e->joined_row;
    return old_env_no;
  }
  
  /* advance to the next environment number */
  void
  nselect_next_environment ()
  {
!   int step = 1;
!   if (joined_row >= 0)
!     step += joined_column;
!   if (current_env_no + step > last_column) {
      line_error (_("Too many columns in multitable item (max %d)"), 
last_column);
      return;
    }
!   select_output_environment (current_env_no + step);
  }
  
  
  /* do anything needed at the beginning of processing a
     multitable column. */
  void
  init_column ()
  {
***************
*** 395,567 ****
  int
  multitable_item ()
  {
    if (!multitable_active) {
      line_error ("multitable_item internal error: no active multitable");
      xexit (1);
    }
  
!   if (html)
!     {
!       if (!first_row)
!       add_word ("<br></td></tr>");    /* <br> for non-tables browsers. */
!       add_word ("<tr align=\"left\"><td valign=\"top\">");
!       first_row = 0;
!       return 0;
!     }
!   /*  else if (docbook)*/ /* 05-08 */
!   else if (xml)
      {
        xml_end_multitable_row (first_row);
        first_row = 0;
        return 0;
      }
!   first_row = 0;
  
!   if (current_env_no > 0) {
      output_multitable_row ();
!   }
    /* start at column 1 */
    select_output_environment (1);
    if (!output_paragraph) {
      line_error (_("Cannot select column #%d in multitable"), current_env_no);
      exit (1);
    }
  
    init_column ();
  
    return 0;
  }
  
  static void
  output_multitable_row ()
  {
!   /* offset in the output paragraph of the next char needing
!      to be output for that column. */
!   int offset[MAXCOLS];
!   int i, j, s, remaining;
    int had_newline = 0;
  
!   for (i = 0; i <= last_column; i++)
!     offset[i] = 0;
  
!   /* select the current environment, to make sure the env variables
!      get updated */
!   select_output_environment (current_env_no);
! 
! #define CHAR_ADDR(n) (offset[i] + (n))
! #define CHAR_AT(n) (envs[i].output_paragraph[CHAR_ADDR(n)])
! 
!   /* remove trailing whitespace from each column */
!   for (i = 1; i <= last_column; i++) {
!     if (envs[i].output_paragraph_offset)
!       while (cr_or_whitespace (CHAR_AT (envs[i].output_paragraph_offset - 1)))
!         envs[i].output_paragraph_offset--;
  
!     if (i == current_env_no)
!       output_paragraph_offset = envs[i].output_paragraph_offset;
!   }
  
!   /* read the current line from each column, outputting them all
!      pasted together.  Do this til all lines are output from all
!      columns.  */
!   for (;;) {
!     remaining = 0;
!     /* first, see if there is any work to do */
!     for (i = 1; i <= last_column; i++) {
!       if (CHAR_ADDR (0) < envs[i].output_paragraph_offset) {
!         remaining = 1;
!         break;
!       }
!     }
!     if (!remaining)
!       break;
!     
!     for (s = 0; s < envs[0].current_indent; s++)
!       out_char (' ');
!     
!     if (vsep)
!       out_char ('|');
  
!     for (i = 1; i <= last_column; i++) {
!       for (s = 0; s < envs[i].current_indent; s++)
!         out_char (' ');
!       for (j = 0; CHAR_ADDR (j) < envs[i].output_paragraph_offset; j++) {
!         if (CHAR_AT (j) == '\n')
!           break;
!         out_char (CHAR_AT (j));
!       }
!       offset[i] += j + 1;       /* skip last text plus skip the newline */
!       
!       /* Do not output trailing blanks if we're in the last column and
!          there will be no trailing |.  */
!       if (i < last_column && !vsep)
!         for (; j <= envs[i].fill_column; j++)
!           out_char (' ');
!       if (vsep)
!         out_char ('|'); /* draw column separator */
!     }
!     out_char ('\n');    /* end of line */
!     had_newline = 1;
!   }
!   
!   /* If completely blank item, get blank line despite no other output.  */
!   if (!had_newline)
!     out_char ('\n');    /* end of line */
  
!   if (hsep)
!     draw_horizontal_separator ();
  
!   /* Now dispose of the buffered output. */
!   for (i = 1; i <= last_column; i++) {
!     select_output_environment (i);
!     init_paragraph ();
!   }
! }
  
  #undef CHAR_AT
  #undef CHAR_ADDR
  
  /* select a new column in current row of multitable */
  void
  cm_tab ()
  {
    if (!multitable_active)
      error (_("ignoring @tab outside of multitable"));
    
!   if (html)
!     add_word ("</td><td valign=\"top\">");
!   /*  else if (docbook)*/ /* 05-08 */
!   else if (xml)
      xml_end_multitable_column ();
    else
      nselect_next_environment ();
  
    init_column ();
  }
  
  /* close a multitable, flushing its output and resetting
     whatever needs resetting */
  void
  end_multitable ()
  {
!   if (!html && !docbook) 
      output_multitable_row ();
  
    /* Multitables cannot be nested.  Otherwise, we'd have to save the
       previous output environment number on a stack somewhere, and then
       restore to that environment.  */
    select_output_environment (0);
    multitable_active = 0;
    uninhibit_output_flushing ();
    close_insertion_paragraph ();
  
    if (html)
!     add_word ("<br></td></tr></table>\n");
    /*  else if (docbook)*/ /* 05-08 */
    else if (xml)
      xml_end_multitable ();
  
  #if 0
    printf (_("** Multicolumn output from last row:\n"));
    for (i = 1; i <= last_column; i++) {
      select_output_environment (i);
--- 431,687 ----
  int
  multitable_item ()
  {
    if (!multitable_active) {
      line_error ("multitable_item internal error: no active multitable");
      xexit (1);
    }
  
!   if (xml)
      {
        xml_end_multitable_row (first_row);
        first_row = 0;
        return 0;
      }
!   /*  else if (docbook)*/ /* 05-08 */
  
!   if (current_env_no > 0)
      output_multitable_row ();
! 
    /* start at column 1 */
    select_output_environment (1);
    if (!output_paragraph) {
      line_error (_("Cannot select column #%d in multitable"), current_env_no);
      exit (1);
    }
  
    init_column ();
  
    return 0;
  }
  
  static void
  output_multitable_row ()
  {
!   int col;
    int had_newline = 0;
  
!   /* select the out of multitable environment, to make sure the env
!      variables get updated */
!   select_output_environment (0);
  
!   if (html)
!     {
!       add_word ("<tr align=\"left\">");
!       for (col = 1; col <= last_column; col += 1 + envs[col].joined_column)
!       {
!         if (envs[col].joined_row >= 0)
!           {
!             int s;
!             add_word ("<td valign=\"top\"");
!             if (envs[col].joined_column)
!               add_word_args(" colspan=\"%d\"", envs[col].joined_column + 1);
!             if (envs[col].joined_row)
!               add_word_args(" rowspan=\"%d\"", envs[col].joined_row + 1);
!             if (envs[col].fill_column)
!               /* 8 is magic number for some browsers */
!               add_word_args(" width=\"%d*\"", envs[col].fill_column * 8);
!             add_word (">");
!             for (s = 0; s < envs[col].output_paragraph_offset; s++)
!               {
!                 add_char (envs[col].output_paragraph[s]);
!               }
!             add_word ("<br></td>");   /* <br> for non-tables browsers. */
!           }
!       }
!       add_word ("</tr>\n");
!     }
!   /* else if (xml)    xml shold be rewritten to support span */       
!   /* else if (docbook)        docbook shold be rewritten to support span */   
!   else
!     {
! #define CHAR_ADDR(col) (envs[col].output_offset)
! #define CHAR_AT(col) (envs[col].output_paragraph[CHAR_ADDR(col)])
! #define CHAR_AT_LAST(col) 
(envs[col].output_paragraph[envs[col].output_paragraph_offset - 1])
! 
!       for (col = 1; col <= last_column; col++) {
!       /* remove trailing whitespace from each column */
!       if (envs[col].output_paragraph_offset)
!         while (cr_or_whitespace (CHAR_AT_LAST (col)))
!           envs[col].output_paragraph_offset--;
!       }
  
!       /* read the current line from each column, outputting them all
!        pasted together.  Do this til all lines are output from all
!        columns.  */
!       for (;;) {
!       int s;
!       int remaining = 0;
!       /* first, see if there is any work to do */
!       for (col = 1; col <= last_column; col += envs[col].joined_column + 1) {
!         if ((envs[col].joined_row == 0 || envs[col].joined_row == -1)
!             && CHAR_ADDR (col) < envs[col].output_paragraph_offset) {
!           remaining = 1;
!           break;
!         }
!       }
  
!       if (!remaining && !hsep)
!         break;
  
!       for (s = 0; s < current_indent; s++)
!         out_char (' ');
  
!       if (vsep)
!         out_char (remaining ? '|' : '+');
  
!       col = 1;
!       while (col <= last_column)
!         {
!           if (remaining || envs[col].joined_row > 0)
!             {
!               /* output columns */
!               s = 0;
!               for (; s < envs[col].current_indent; s++)
!                 out_char (' ');
!               for (;
!                    CHAR_ADDR (col) < envs[col].output_paragraph_offset;
!                    s++, CHAR_ADDR (col)++) {
!                 if (CHAR_AT (col) == '\n')
!                   {
!                     CHAR_ADDR (col)++;
!                     break;
!                   }
!                 out_char (CHAR_AT (col));
!               }
! 
!               /* Do not output trailing blanks if we're in the last
!                  column and there will be no trailing |.  */
! 
!               if (col < last_column || vsep)
!                 {
!                   for (; s < envs[col].fill_column; s++)
!                     out_char (' ');
!                   if (s <= envs[col].fill_column)
!                     {
!                       if (vsep)
!                         out_char (remaining ? '|' : '+');
!                       else
!                         out_char (remaining ? ' ' : '-');
!                     }
!                 }
!               col += envs[col].joined_column + 1;
!             }
!           else
!             {
!               /* output horizontal separator */
!               for (s = 0; s < envs[col].default_fill_column; s++)
!                 out_char ('-');
!               if (vsep)
!                 out_char ('+');       /* draw quadcolumn separator */
!               else
!                 out_char ('-');
!               col++;
!             }
!         }
!       out_char ('\n');    /* end of line */
!       if (!remaining)
!         break;
!       }
  
+ #undef CHAR_AT_LAST
  #undef CHAR_AT
  #undef CHAR_ADDR
+     }
+     
+   /* Now dispose of the buffered output. */
+   for (col = 1; col <= last_column; col++) {
+     select_output_environment (col);
+     if (joined_row > 0)
+       joined_row = - joined_row;      /* minus means coverd by joining cell*/
+     else if (joined_row < -1)
+       joined_row ++;
+     else {
+       fill_column = default_fill_column;
+       output_offset = 0;
+       joined_column = 0;
+       joined_row = 0;
+       init_paragraph ();
+     }
+   }
+ }
  
  /* select a new column in current row of multitable */
  void
  cm_tab ()
  {
    if (!multitable_active)
      error (_("ignoring @tab outside of multitable"));
    
!   if (xml)
      xml_end_multitable_column ();
+   /*  else if (docbook)*/ /* 05-08 */
    else
      nselect_next_environment ();
  
    init_column ();
  }
  
+ /* make next column jointed horizontally with current cell */
+ void
+ cm_tabhspan ()
+ {
+   if (!multitable_active)
+     error (_("ignoring @tabhspan outside of multitable"));
+   
+   if (xml)
+     xml_end_multitable_column ();
+   /*  else if (docbook)*/ /* 05-08 */
+   else
+     {
+       if (current_env_no + joined_column >= last_column) {
+       line_error (_("Too many columns in multitable item (max %d)"), 
last_column);
+       return;
+       }
+       joined_column++;
+       fill_column += envs[current_env_no + joined_column].fill_column + 1;
+     }
+   init_column ();
+ }
+ 
+ /* make next row jointed verticaly with current cell */
+ void
+ cm_tabvspan ()
+ {
+   /*  if (xml) */
+   /*  else if (docbook) */ /* 05-08 */
+   /*  else */
+   joined_row++;
+   init_column ();
+ }
+ 
  /* close a multitable, flushing its output and resetting
     whatever needs resetting */
  void
  end_multitable ()
  {
!   if (!docbook) 
      output_multitable_row ();
  
    /* Multitables cannot be nested.  Otherwise, we'd have to save the
       previous output environment number on a stack somewhere, and then
       restore to that environment.  */
    select_output_environment (0);
    multitable_active = 0;
    uninhibit_output_flushing ();
    close_insertion_paragraph ();
  
    if (html)
!     add_word ("</table>\n");
    /*  else if (docbook)*/ /* 05-08 */
    else if (xml)
      xml_end_multitable ();
  
  #if 0
    printf (_("** Multicolumn output from last row:\n"));
    for (i = 1; i <= last_column; i++) {
      select_output_environment (i);
\input texinfo.tex @c -*-texinfo-*-
@c header
@setfilename iso-10589
@documentlanguage ja
@c @documentencoding EUC-JP
@settitle Information technology - Telecommunications and Information exchange
between systems - Intermediate system to Intermediate system Intra-Domain 
routeing information exchange protocol for use in conjunction with the Protocol 
for providing the Connectionless-mode Network Service (ISO 8473)

@setchapternewpage odd

@titlepage

@center @b{INTERNATIONAL STANDARD}

@flushright
@example
INTERNATIONAL ORGANIZATION FOR STANDARDIZATION
ORGANISATION INTERNATIONALE DE NORMALISATION
@end example
@end flushright

@title Information technology - Telecommunications and Information exchange 
between systems - Intermediate system to Intermediate system Intra-Domain 
routeing information exchange protocol for use in conjunction with the Protocol 
for providing the Connectionless-mode Network Service (ISO 8473)
@subtitle ISO/IEC address@hidden 1992-01-15

Technologies de l'information - Communication de donn@'ees et @'echange 
d'information entre address@hidden - Protocole intra-domain de routage d'un 
address@hidden intermediare @`a un address@hidden intermediare @`a utiliser 
conjointement avec le protocole fournissant le service de r@'eseau en mode sans 
connexion (ISO 8473)
@end titlepage

@node  Top, Table 5, (dir), (dir)
@comment  node-name,  next,  previous,  up
@top Information technology - Telecommunications and Information exchange 
between systems - Intermediate system to Intermediate system Intra-Domain 
routeing information exchange protocol for use in conjunction with the Protocol 
for providing the Connectionless-mode Network Service (ISO 8473)

@flushright
@example
ISO/IEC 10589
Draft 1992-01-15
@end example
@end flushright

@center @b{INTERNATIONAL STANDARD}

@flushright
@example
INTERNATIONAL ORGANIZATION FOR STANDARDIZATION
ORGANISATION INTERNATIONALE DE NORMALISATION
@end example
@end flushright

@center @b{Information technology - Telecommunications and Information exchange 
between systems - Intermediate system to Intermediate system Intra-Domain 
routeing information exchange protocol for use in conjunction with the Protocol 
for providing the Connectionless-mode Network Service (ISO 8473)}


Technologies de l'information - Communication de donn@'ees et @'echange 
d'information entre address@hidden - Protocole intra-domain de routage d'un 
address@hidden intermediare @`a un address@hidden intermediare @`a utiliser 
conjointement avec le protocole fournissant le service de r@'eseau en mode sans 
connexion (ISO 8473)

@menu
* Table 5::                     
@end menu

@node Table 5,  , Top, Top
@comment  node-name,  next,  previous,  up
@chapter Table 5 in clause 8.2.4.2

@center Table 5 - Level 1 state table for matching areas
@multitable {Circuit Type} {action for Adjacency no type} {action for Level 1 
Adjacency} @hsep @vsep
@item Circuit Type @tab @tab Adjacency Usage
@c below is sample of jointed columns.
@c @item @tabvspan Circuit Type @tab @tabhspan Adjacency Usage
@item @tab none @tab Level 1
@item Level 1 only @tab Up L15 @tab Accept
@item Level 2 only @tab Reject (Wrong system) @tab Down (Wrong system)
@item Level 1 and 2 @tab Up L1 @tab Accept
@end multitable

@enumerate x
@item first item
@item second item
@item third item
@item forth item
@end enumerate

@bye

reply via email to

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