Print this page
9718 update mandoc to 1.14.4
   1 /*      $Id: tree.c,v 1.77 2017/07/08 14:51:05 schwarze Exp $ */
   2 /*
   3  * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
   4  * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
   5  *
   6  * Permission to use, copy, modify, and distribute this software for any
   7  * purpose with or without fee is hereby granted, provided that the above
   8  * copyright notice and this permission notice appear in all copies.
   9  *
  10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
  11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
  13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17  */
  18 #include "config.h"
  19 
  20 #include <sys/types.h>
  21 
  22 #include <assert.h>
  23 #include <limits.h>
  24 #include <stdio.h>


  98                 t = "block";
  99                 break;
 100         case ROFFT_HEAD:
 101                 t = "head";
 102                 break;
 103         case ROFFT_BODY:
 104                 if (n->end)
 105                         t = "body-end";
 106                 else
 107                         t = "body";
 108                 break;
 109         case ROFFT_TAIL:
 110                 t = "tail";
 111                 break;
 112         case ROFFT_ELEM:
 113                 t = "elem";
 114                 break;
 115         case ROFFT_TEXT:
 116                 t = "text";
 117                 break;



 118         case ROFFT_TBL:
 119                 break;
 120         case ROFFT_EQN:
 121                 t = "eqn";
 122                 break;
 123         default:
 124                 abort();
 125         }
 126 
 127         switch (n->type) {
 128         case ROFFT_TEXT:

 129                 p = n->string;
 130                 break;
 131         case ROFFT_BODY:
 132                 p = roff_name[n->tok];
 133                 break;
 134         case ROFFT_HEAD:
 135                 p = roff_name[n->tok];
 136                 break;
 137         case ROFFT_TAIL:
 138                 p = roff_name[n->tok];
 139                 break;
 140         case ROFFT_ELEM:
 141                 p = roff_name[n->tok];
 142                 if (n->args) {
 143                         argv = n->args->argv;
 144                         argc = n->args->argc;
 145                 }
 146                 break;
 147         case ROFFT_BLOCK:
 148                 p = roff_name[n->tok];


 214 print_man(const struct roff_node *n, int indent)
 215 {
 216         const char       *p, *t;
 217         int               i;
 218 
 219         if (n == NULL)
 220                 return;
 221 
 222         t = p = NULL;
 223 
 224         switch (n->type) {
 225         case ROFFT_ROOT:
 226                 t = "root";
 227                 break;
 228         case ROFFT_ELEM:
 229                 t = "elem";
 230                 break;
 231         case ROFFT_TEXT:
 232                 t = "text";
 233                 break;



 234         case ROFFT_BLOCK:
 235                 t = "block";
 236                 break;
 237         case ROFFT_HEAD:
 238                 t = "head";
 239                 break;
 240         case ROFFT_BODY:
 241                 t = "body";
 242                 break;
 243         case ROFFT_TBL:
 244                 break;
 245         case ROFFT_EQN:
 246                 t = "eqn";
 247                 break;
 248         default:
 249                 abort();
 250         }
 251 
 252         switch (n->type) {
 253         case ROFFT_TEXT:

 254                 p = n->string;
 255                 break;
 256         case ROFFT_ELEM:
 257         case ROFFT_BLOCK:
 258         case ROFFT_HEAD:
 259         case ROFFT_BODY:
 260                 p = roff_name[n->tok];
 261                 break;
 262         case ROFFT_ROOT:
 263                 p = "root";
 264                 break;
 265         case ROFFT_TBL:
 266                 break;
 267         case ROFFT_EQN:
 268                 p = "EQ";
 269                 break;
 270         default:
 271                 abort();
 272         }
 273 


   1 /*      $Id: tree.c,v 1.78 2018/04/11 17:11:13 schwarze Exp $ */
   2 /*
   3  * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
   4  * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
   5  *
   6  * Permission to use, copy, modify, and distribute this software for any
   7  * purpose with or without fee is hereby granted, provided that the above
   8  * copyright notice and this permission notice appear in all copies.
   9  *
  10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
  11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
  13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17  */
  18 #include "config.h"
  19 
  20 #include <sys/types.h>
  21 
  22 #include <assert.h>
  23 #include <limits.h>
  24 #include <stdio.h>


  98                 t = "block";
  99                 break;
 100         case ROFFT_HEAD:
 101                 t = "head";
 102                 break;
 103         case ROFFT_BODY:
 104                 if (n->end)
 105                         t = "body-end";
 106                 else
 107                         t = "body";
 108                 break;
 109         case ROFFT_TAIL:
 110                 t = "tail";
 111                 break;
 112         case ROFFT_ELEM:
 113                 t = "elem";
 114                 break;
 115         case ROFFT_TEXT:
 116                 t = "text";
 117                 break;
 118         case ROFFT_COMMENT:
 119                 t = "comment";
 120                 break;
 121         case ROFFT_TBL:
 122                 break;
 123         case ROFFT_EQN:
 124                 t = "eqn";
 125                 break;
 126         default:
 127                 abort();
 128         }
 129 
 130         switch (n->type) {
 131         case ROFFT_TEXT:
 132         case ROFFT_COMMENT:
 133                 p = n->string;
 134                 break;
 135         case ROFFT_BODY:
 136                 p = roff_name[n->tok];
 137                 break;
 138         case ROFFT_HEAD:
 139                 p = roff_name[n->tok];
 140                 break;
 141         case ROFFT_TAIL:
 142                 p = roff_name[n->tok];
 143                 break;
 144         case ROFFT_ELEM:
 145                 p = roff_name[n->tok];
 146                 if (n->args) {
 147                         argv = n->args->argv;
 148                         argc = n->args->argc;
 149                 }
 150                 break;
 151         case ROFFT_BLOCK:
 152                 p = roff_name[n->tok];


 218 print_man(const struct roff_node *n, int indent)
 219 {
 220         const char       *p, *t;
 221         int               i;
 222 
 223         if (n == NULL)
 224                 return;
 225 
 226         t = p = NULL;
 227 
 228         switch (n->type) {
 229         case ROFFT_ROOT:
 230                 t = "root";
 231                 break;
 232         case ROFFT_ELEM:
 233                 t = "elem";
 234                 break;
 235         case ROFFT_TEXT:
 236                 t = "text";
 237                 break;
 238         case ROFFT_COMMENT:
 239                 t = "comment";
 240                 break;
 241         case ROFFT_BLOCK:
 242                 t = "block";
 243                 break;
 244         case ROFFT_HEAD:
 245                 t = "head";
 246                 break;
 247         case ROFFT_BODY:
 248                 t = "body";
 249                 break;
 250         case ROFFT_TBL:
 251                 break;
 252         case ROFFT_EQN:
 253                 t = "eqn";
 254                 break;
 255         default:
 256                 abort();
 257         }
 258 
 259         switch (n->type) {
 260         case ROFFT_TEXT:
 261         case ROFFT_COMMENT:
 262                 p = n->string;
 263                 break;
 264         case ROFFT_ELEM:
 265         case ROFFT_BLOCK:
 266         case ROFFT_HEAD:
 267         case ROFFT_BODY:
 268                 p = roff_name[n->tok];
 269                 break;
 270         case ROFFT_ROOT:
 271                 p = "root";
 272                 break;
 273         case ROFFT_TBL:
 274                 break;
 275         case ROFFT_EQN:
 276                 p = "EQ";
 277                 break;
 278         default:
 279                 abort();
 280         }
 281