home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / dca2troff / do_single.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-02-18  |  2.0 KB  |  85 lines

  1. #include "dca2troff.h"
  2.  
  3. /* single byte control character */
  4. do_single(c)
  5. int c;
  6. {
  7.     switch (c)
  8.     {
  9.     case 0x05:            /* "HT"        tab */
  10.         in_fcr = 1;
  11.         outstr("\t");
  12.         return;
  13.     case 0x33:            /* "IRT"    index return */
  14.     case 0x06:            /* "RCR"    required carrier ret */
  15.         outstr("\n.br\n");
  16.         if(in_it != 0)
  17.             outstr(".in 0\n");
  18.         in_it == 0;            /* reset in_it */
  19.         return;
  20.     case 0x09:            /* "SPS"    superscript */
  21.         outstr("\\u");            /* up half a line */
  22.         return;
  23.     case 0x0c:            /* "PE"        page end */
  24.         outstr("\n");
  25.         return;
  26.     case 0x0d:            /* "ZICR"    zero index carrier
  27.                             return */
  28.         return;                /* go to pos 0 on current
  29.                         line */
  30.     case 0x15:            /* "CRE"    carrier return */
  31.         if ( in_fcr == 1)
  32.             outstr("\n.br\n");        /* forced cr */
  33.         else
  34.             outstr("\n");            /* just an eol */
  35.         in_fcr = 0;                /* reset in_fcr */
  36.         return;
  37.     case 0x16:            /* "BS"        backspace */
  38.         outstr("\b");
  39.         return;
  40.     case 0x1a:            /* "UBS"    unit backspace */
  41.         outstr("\b");
  42.         return;
  43.     case 0x23:            /* "WUS"    word underscore */
  44.                         /* back to last word break */
  45.         printf("\\fI");            /* start the underscore */
  46.         outachar('\177');        /* flush last word */
  47.         printf("\\fR");            /* back to roman */
  48.         return;
  49.     case 0x25:            /* "INX"    index */
  50.         return;                /* line feed? */
  51.     case 0x36:            /* "NBS"    numeric backspace */
  52.         outstr("\\h'-\\w'1'u'");
  53.         return;
  54.     case 0x38:            /* "SBS"    subscript */
  55.         outstr("\\d");            /* down half a line */
  56.         return;
  57.     case 0x39:            /* "IT"        indent tab */
  58.         in_fcr = 1;
  59.         in_it = 1;
  60.         outstr("\n'in+.5i\n");        /* move indent plus a stop */
  61.         return;
  62.     case 0x3a:            /* "RPE"    required page end */
  63.         outstr("\n.bp\n");
  64.         return;
  65.     case 0x3f:            /* "SUB"    substitute */
  66.         outstr("_");            /* inserted in place of err */
  67.         return;
  68.     case 0x40:            /* "SP"        space */
  69.     case 0x41:
  70.         outstr(" ");        /* "RSP"    required space */
  71.         return;
  72.     case 0x60:            /* "HYP"    required hyphen */
  73.         outstr("-");
  74.         return;
  75.     case 0xca:            /* "SHY"    syllable hyphen */
  76.         return;
  77.     case 0xe1:            /* "NSP"    numeric space */
  78.         outstr("\\h'\\w'1'u'");
  79.         return;
  80.     default:
  81.         fprintf(stderr, "unknown single char code (x%02x)\n", c);
  82.         exit(1);;
  83.     }
  84. }
  85.