delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/07/06/17:29:48

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3964F814.3E86CAFD@phekda.freeserve.co.uk>
Date: Thu, 06 Jul 2000 22:20:20 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: mkdoc patch
Reply-To: djgpp-workers AT delorie DOT com

This is a multi-part message in MIME format.
--------------B576F6DA4333BCA078177C13
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello.

Please find attached a patch for mkdoc, which tabulates the portability
information. I also added Unix98 as a target. Also attached is an update
for the what's-changed file. mkdoc should now tabulate the results like:

   Portability
   -----------

   ANSI     Yes
   POSIX    Yes (see note 1)
   Unix98   Unknown

   Notes:

      1. The return-value of one is DJGPP-specific.

I tried two other styles:

1. a multitable with the column widths split per target - this looked too
spaced-out and messy, since the notes were put as a third row;

2. a normal table (@table @asis) - this looked OK, but too up too much
screen space, IMO.

I think the above style (aka style 3) was best, both in info and HTML
format. I can send diffs for the other two styles, if anybody is
interested. I also still have the HTML & info files. If the addition of
Unix98 target is not desired, I will send a new diff.

Bye, Rich =]

-- 
Richard Dawe
[ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]
--------------B576F6DA4333BCA078177C13
Content-Type: text/plain; charset=us-ascii;
 name="mkdoc3.cc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mkdoc3.cc.diff"

*** mkdoc.cc.orig	Mon Jul  3 21:48:59 2000
--- mkdoc3.cc	Thu Jul  6 22:11:42 2000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
***************
*** 30,36 ****
  typedef void (*TFunc)(Node *);
  
  
! #define NUM_PORT_TARGETS 2
  
  #define PORT_UNKNOWN 0
  #define PORT_NO      1
--- 31,37 ----
  typedef void (*TFunc)(Node *);
  
  
! #define NUM_PORT_TARGETS 3
  
  #define PORT_UNKNOWN 0
  #define PORT_NO      1
***************
*** 38,46 ****
  #define PORT_YES     3
  
  /* Tokens for use in .txh files */
! char *port_target[NUM_PORT_TARGETS] = { "ansi", "posix" };
  /* Strings to output in .txi files */
! char *port_target_string[NUM_PORT_TARGETS] = { "ANSI", "POSIX" };
  
  
  struct Tree {
--- 39,47 ----
  #define PORT_YES     3
  
  /* Tokens for use in .txh files */
! char *port_target[NUM_PORT_TARGETS] = { "ansi", "posix", "unix98" };
  /* Strings to output in .txi files */
! char *port_target_string[NUM_PORT_TARGETS] = { "ANSI", "POSIX", "Unix98" };
  
  
  struct Tree {
***************
*** 233,284 ****
  
  void
  Node::write_portability()
! {
    char buffer[1024] = { 0 };
    int note_number = 1;
  
    for (int i = 0; i < NUM_PORT_TARGETS; i++)
    {
      switch (port_info[i])
      {
        case PORT_NO:
! 	strcat (buffer, "not ");
! 	strcat (buffer, port_target_string[i]);
  	break;
        case PORT_YES:
! 	strcat (buffer, port_target_string[i]);
  	break;
        case PORT_PARTIAL:
! 	strcat (buffer, "partially ");
! 	strcat (buffer, port_target_string[i]);
  	break;
      }
!     if (port_info[i] != PORT_UNKNOWN)
      {
!       for (PortNote *p = port_notes; p; p = p->next)
        {
- 	if (p->target == i)
- 	{
  	  char smallbuffer[20];
  	  p->number = note_number++;
  	  sprintf (smallbuffer, " (see note %d)", p->number);
  	  strcat (buffer, smallbuffer);
  	  break;
- 	}
        }
-       strcat (buffer, ", ");
      }
-   }
  
!   {
!     char *ch = strchr (buffer, 0) - 2;
!     if (*ch == ',')
!       *ch = 0;
!     else
!       strcpy (buffer, "Unknown.");
    }
  
!   strcat (buffer, "\n\n");
    add(buffer);
  
    if (note_number > 1)
--- 234,311 ----
  
  void
  Node::write_portability()
! {  
!   /* Maximum size of right-hand column:
!    * = maximum info length + maximum note length + null. */
!   static char rightpad[7 + 14 + 1] = { 0 };
! 
!   static int largest_target = -1;
    char buffer[1024] = { 0 };
    int note_number = 1;
  
+   /* Deduce the largest target name length, for table's left-hand column. */
+   if (largest_target == -1)
+   {
+     size_t maxsize = 0;
+ 
+     for (int i = 0; i < NUM_PORT_TARGETS; i++)
+     {
+       if (strlen(port_target_string[i]) > maxsize)
+       {
+ 	maxsize = strlen(port_target_string[i]);
+ 	largest_target = i;
+       }
+     }
+   }
+ 
+   if (rightpad[0] == '\0')
+     memset(rightpad, (int) 'x', sizeof(rightpad) - 1);
+ 
+   strcat (buffer, "@multitable {");
+   strcat (buffer, port_target_string[largest_target]);
+   strcat (buffer, "} {");
+   strcat (buffer, rightpad);
+   strcat (buffer, "}\n");
+ 
    for (int i = 0; i < NUM_PORT_TARGETS; i++)
    {
+     strcat (buffer, "@item ");
+     strcat (buffer, port_target_string[i]);
+     strcat (buffer, " @tab ");
+ 
      switch (port_info[i])
      {
        case PORT_NO:
! 	strcat (buffer, "No");
  	break;
        case PORT_YES:
! 	strcat (buffer, "Yes");
  	break;
        case PORT_PARTIAL:
! 	strcat (buffer, "Partial");
! 	break;
!       default:
! 	strcat (buffer, "Unknown");
  	break;
      }
! 
!     for (PortNote *p = port_notes; p; p = p->next)
      {
!       if (p->target == i)
        {
  	  char smallbuffer[20];
  	  p->number = note_number++;
  	  sprintf (smallbuffer, " (see note %d)", p->number);
  	  strcat (buffer, smallbuffer);
  	  break;
        }
      }
  
!     strcat (buffer, "\n");
    }
  
!   strcat (buffer, "@end multitable\n\n");
! 
    add(buffer);
  
    if (note_number > 1)
***************
*** 495,501 ****
    Node *curnode;
    DIR *d = opendir(which);
    struct dirent *de;
!   while (de = readdir(d))
    {
      if (de->d_name[0] == '.')
        continue;
--- 522,528 ----
    Node *curnode;
    DIR *d = opendir(which);
    struct dirent *de;
!   while ((de = readdir(d)) != NULL)
    {
      if (de->d_name[0] == '.')
        continue;

--------------B576F6DA4333BCA078177C13
Content-Type: text/plain; charset=us-ascii;
 name="wc204.txi.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="wc204.txi.diff"

*** wc204.txi.orig	Mon Jul  3 21:52:28 2000
--- wc204.txi	Mon Jul  3 21:57:21 2000
***************
*** 54,56 ****
--- 54,59 ----
  @findex fsdb AT r{, check for EXE extension}
  @code{fsdb} checks for executables and loads them even if
  the extension @file{.exe} isn't given in the command line.
+ 
+ The portability information in the library documentation is now presented in
+ tabular form, for easier interpretation.

--------------B576F6DA4333BCA078177C13--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019