home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / cmd / struct / 4.form.c < prev    next >
Encoding:
C/C++ Source or Header  |  1979-01-10  |  1.6 KB  |  114 lines

  1. #include <stdio.h>
  2. #
  3. #include "def.h"
  4. #include "4.def.h"
  5. extern int linechars;
  6. extern int rdfree(), comfree(), labfree(), contfree();
  7. extern int rdstand(), comstand(), labstand(), contstand();
  8. extern int (*rline[])();
  9. extern int (*comment[])();
  10. extern int (*getlabel[])();
  11. extern int (*chkcont[])();
  12. null(c)
  13. char c;
  14.     {return;}
  15.  
  16.  
  17.  
  18. comprint()
  19.     {
  20.     int c, blank, first,count;
  21.     blank = 1;
  22.     first = 1;
  23.     count = 0;
  24.     while ((c = (*comment[inputform])(0) ) || blankline() )
  25.         {
  26.         ++count;
  27.         if (c)
  28.             {
  29.             (*comment[inputform])(1);        /* move head past comment signifier */
  30.             blank = blankline();
  31.             /* if (first && !blank)
  32.                 OUTSTR("#\n");*/
  33.             prline("#");
  34.             first = 0;
  35.             }
  36.         else
  37.             (*rline[inputform])(null);
  38.         }
  39.     /* if (!blank) 
  40.         OUTSTR("#\n"); */
  41.     return(count);
  42.     }
  43.  
  44.  
  45.  
  46. prcode(linecount,tab)
  47. int linecount, tab;
  48.     {
  49.     int someout;
  50.     someout = FALSE;
  51.     while (linecount)
  52.         {
  53.         if ( (*comment[inputform])(0) )
  54.             {
  55.             linecount -= comprint();
  56.             someout = TRUE;
  57.             continue;
  58.             }
  59.         else if (blankline() )
  60.             (*rline[inputform])(null);
  61.         else if ((*chkcont[inputform])() )
  62.             {
  63.             TABOVER(tab);
  64.             prline("&");
  65.             someout  = TRUE;
  66.             }
  67.         else 
  68.             {if (someout) TABOVER(tab);
  69.             (*getlabel[inputform])(null);
  70.             prline("");
  71.             someout=TRUE;
  72.             }
  73.         --linecount;
  74.         }
  75.     }
  76.  
  77.  
  78. charout(c)
  79. char c;
  80.     {
  81.     putc(c,outfd);
  82.     }
  83.  
  84.  
  85.  
  86. prline(str)
  87. char *str;
  88.     {
  89.     fprintf(outfd,"%s",str);
  90.     (*rline[inputform]) (charout);
  91.     putc('\n',outfd);
  92.     }
  93.  
  94.  
  95. input2()
  96.     {
  97.     static int c;
  98.     c = inchar();
  99.     if (c == '\n')
  100.         linechars = 0;
  101.     else
  102.         ++linechars;
  103.     return(c);
  104.     }
  105.  
  106.  
  107. unput2(c)
  108. int c;
  109.     {
  110.     unchar(c);
  111.     --linechars;
  112.     return(c);
  113.     }
  114.