LCOV - code coverage report
Current view: top level - preproc/eqn - mark.cpp (source / functions) Hit Total Coverage
Test: GNU roff Lines: 0 50 0.0 %
Date: 2026-01-16 17:51:41 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Copyright 1989-2024 Free Software Foundation, Inc.
       2             :      Written by James Clark (jjc@jclark.com)
       3             : 
       4             : This file is part of groff, the GNU roff typesetting system.
       5             : 
       6             : groff is free software; you can redistribute it and/or modify it under
       7             : the terms of the GNU General Public License as published by the Free
       8             : Software Foundation, either version 3 of the License, or
       9             : (at your option) any later version.
      10             : 
      11             : groff is distributed in the hope that it will be useful, but WITHOUT ANY
      12             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14             : for more details.
      15             : 
      16             : You should have received a copy of the GNU General Public License
      17             : along with this program.  If not, see <http://www.gnu.org/licenses/>. */
      18             : 
      19             : #ifdef HAVE_CONFIG_H
      20             : #include <config.h>
      21             : #endif
      22             : 
      23             : #include "eqn.h"
      24             : #include "pbox.h"
      25             : 
      26             : class mark_box : public pointer_box {
      27             : public:
      28             :   mark_box(box *);
      29             :   int compute_metrics(int);
      30             :   void output();
      31             :   void debug_print();
      32             : };
      33             : 
      34             : // we push down marks so that they don't interfere with spacing
      35             : 
      36           0 : box *make_mark_box(box *p)
      37             : {
      38           0 :   list_box *b = p->to_list_box();
      39           0 :   if (b != 0) {
      40           0 :     b->list.p[0] = make_mark_box(b->list.p[0]);
      41           0 :     return b;
      42             :   }
      43             :   else
      44           0 :     return new mark_box(p);
      45             : }
      46             : 
      47           0 : mark_box::mark_box(box *pp) : pointer_box(pp)
      48             : {
      49           0 : }
      50             : 
      51           0 : void mark_box::output()
      52             : {
      53           0 :   p->output();
      54           0 : }
      55             : 
      56           0 : int mark_box::compute_metrics(int style)
      57             : {
      58           0 :   int res = p->compute_metrics(style);
      59           0 :   if (res)
      60           0 :     error("multiple marks and lineups");
      61           0 :   printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid);
      62           0 :   printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid);
      63           0 :   printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid);
      64           0 :   printf(".nr " MARK_REG " 0\n");
      65           0 :   return FOUND_MARK;
      66             : }
      67             : 
      68           0 : void mark_box::debug_print()
      69             : {
      70           0 :   fprintf(stderr, "mark { ");
      71           0 :   p->debug_print();
      72           0 :   fprintf(stderr, " }");
      73           0 : }
      74             : 
      75             : 
      76             : class lineup_box : public pointer_box {
      77             : public:
      78             :   lineup_box(box *);
      79             :   void output();
      80             :   int compute_metrics(int style);
      81             :   void debug_print();
      82             : };
      83             : 
      84             : // we push down lineups so that they don't interfere with spacing
      85             : 
      86           0 : box *make_lineup_box(box *p)
      87             : {
      88           0 :   list_box *b = p->to_list_box();
      89           0 :   if (b != 0) {
      90           0 :     b->list.p[0] = make_lineup_box(b->list.p[0]);
      91           0 :     return b;
      92             :   }
      93             :   else
      94           0 :     return new lineup_box(p);
      95             : }
      96             : 
      97           0 : lineup_box::lineup_box(box *pp) : pointer_box(pp)
      98             : {
      99           0 : }
     100             : 
     101           0 : void lineup_box::output()
     102             : {
     103           0 :   p->output();
     104           0 : }
     105             : 
     106           0 : int lineup_box::compute_metrics(int style)
     107             : {
     108           0 :   int res = p->compute_metrics(style);
     109           0 :   if (res)
     110           0 :     error("multiple marks and lineups");
     111           0 :   printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid);
     112           0 :   printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid);
     113           0 :   printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid);
     114           0 :   printf(".nr " MARK_REG " 0\n");
     115           0 :   return FOUND_LINEUP;
     116             : }
     117             : 
     118           0 : void lineup_box::debug_print()
     119             : {
     120           0 :   fprintf(stderr, "lineup { ");
     121           0 :   p->debug_print();
     122           0 :   fprintf(stderr, " }");
     123           0 : }
     124             : 
     125             : // Local Variables:
     126             : // fill-column: 72
     127             : // mode: C++
     128             : // End:
     129             : // vim: set cindent noexpandtab shiftwidth=2 textwidth=72:

Generated by: LCOV version 1.14