Troff Inquiries : Summary of Responses

Ephraim Silverberg 0210097%techunix.BITNET at ucb-vax.ARPA
Wed Apr 17 14:06:10 AEST 1985


I received two responses to my 'Troff Inquiries'; here they are:

--------------------------------------------------------------------------------
Bradley Smith (cepu!bradley!brad at ucla-locus.arpa) writes:
--------------------------------------------------------------------------------
      (1) What does 'troff' output?  I have been told it is  CAT  pho-
          tosetter codes; what are CAT photosetter codes and where can
          I find more information about them?
There are C/A/T codes and the best place is a manual.
      (2)  I  have  been  told  that   by   piping   'troff'   through
          /usr/lib/vcat  and /usr/lib/rvcat the output is converted to
          a raster of bits.  What does this mean  and  what  do  these
          programmes do?
This is right.
      (3) Finally, assuming that I have all  the  information  needed,
          how do I go about getting it to work on a particular printer
          (i.e.  the LA100).  I have the escape sequence that puts the
          LA100  in  graphics  mode  and  I know how the graphics mode
          works (in addition to knowing  the  specifications  --  e.g.
          dots per inch horizontally and vertically).
I also have a LA100 and wrote a program to take take vcat output and produce
a file to go to a LA100.  There is no doc or copyright notice but if you
use you might note where it came from. Also let me know if you get this
message.


Bradley Smith            UUCP: {cepu,ihnp4,noao,uiucdcs}!bradley!brad
Text Processing            ARPA: cepu!bradley!brad at UCLA-LOCUS
Bradley University        PH: (309) 676-7611 Ext. 446
Peoria, IL 61625
=========cut here=============
#include        <stdio.h>

/* program to take vcat output -> LA100 */
main(argc,argv)
int argc;
char *argv[];
{
        char line[264*6],gline[2000];
    char newline[264*18];
    char bit0,bit1,bit2,bit3,bit4,bit5,bit6,bit7,xx,x1,x2,x3;
        unsigned int c,c1,c2,c3,c4,c5,c6,cx;
        register int i,n,j,k;
    int l;

        while((n=read(0,newline,264*18)) != -1) {
        if(n == 0)
            goto end;
                if(n < 264*18)
            for(;n<264*18;n++)
                newline[n]=' ';
/* now condense */
        for(i=0,j=0; j<=17; i++, j=j+3) {
            for(l=0,k=0; k<=263; l++, k=k+3) {
                x1 = newline[(j*264)+k];
                x2 = newline[(j*264)+k+1];
                x3 = newline[(j*264)+k+2];

                bit0 = (x1 & 0200);
                if(!bit0) {
                    if((x1 & 0100))
                        bit0 = 0200;
                }
                bit1 = (x1 & 020) << 2;
                if(!bit1) {
                   if((x1&040)||(x1&010))
                    bit1 = 020 << 2;
                }
                bit2 = (x1 & 02) << 4;
                if(!bit2) {
                   if((x1&04)||(x1&01))
                    bit2 = 02 << 4;
                }
                bit3 = (x2 & 0100) >> 2;
                if(!bit3) {
                   if((x2&0200)||(x2&040))
                    bit3 = 0100 >> 2;
                }
                bit4 = (x2 & 010);
                if(!bit4) {
                   if((x2&020)||(x2&04))
                    bit4 = 010;
                }
                bit5 = (x2 & 01) << 2;
                if(!bit5) {
                   if(x2&02)
                    bit5 = 01 << 2;
                }
                bit6 = (x3 & 040) >> 4;
                if(!bit6) {
                   if((x3&0100)||(x3&020))
                    bit6 = 040 >> 4;
                }
                bit7 = (x3 & 04) >> 2;
                if(!bit7) {
                   if((x3&010)||(x3&02))
                    bit7 = 04 >> 2;
                }

                line[(i*264)+l] = bit1 | bit2 | bit3
                        | bit4 | bit5 | bit6
                        | bit7;
            }
        }

                for(i = 0;i < 88;i++) {
                   cx = 0200;
                   for(n=0;n<8;n++) {
                        c1 = (unsigned) line[i] & cx; c1 = c1>>7-n;
                        c2 = (unsigned) line[i+264] & cx; c2 = c2>> 6-n;
                        c3 = (unsigned) line[i+(264*2)] & cx; c3 = c3 >> 5-n;
                        c4 = (unsigned) line[i+(264*3)] & cx; c4 = c4 >> 4-n;
                        c5 = (unsigned) line[i+(264*4)] & cx; c5 = c5 >> 3-n;
                        c6 = (unsigned) line[i+(264*5)] & cx; c6 = c6 >> 2-n;
                        cx = cx >> 1;
                        c =(c1|c2|c3|c4|c5|c6);
                        gline[(i*8)+n]= (char) (c & 0X3F) + 077;
                    }
                }
        for(j = (i * 8)-1; j && gline[j] == ' 77';j--)
            ;
                gline[j+1]=' 55';
                write(1,&gline,j+2);
        }
end:
    ;
}
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------
Dave Sherman (ihnp4!utzoo!lsuc!dave) writes:
--------------------------------------------------------------------------------
Yes, it output code for the CAT phototypesetter. As far as I
know, reading the code to vcat is the best way to figure out
the obscure CAT codes. Raster format means lots of bits - not
vectors. You end up with a bit map from vcat, for the Versatec,
which is 2112 bits across the page, I recall. You'll probably
want to change the vcat source for your application so it doesn't
convert to raster at all, but takes the chars and draws them on
your LA-100. But you'll need a font for your LA-100. Hope this
helps. Take a look at the source to vcat.
--------------------------------------------------------------------------------

Please honour Mr. Smith's request that some mention be made when using his  pro-
gramme.

--------------------------------------------------------------------------------

Ephraim Silverberg

BITNET  : 0210097 at techunix
ARPANET : 0210097%techunix.bitnet at wiscvm.arpa
UUCP    : 0210097%techunix.BITNET at psuvax1.UUCP

--------------------------------------------------------------------------------



More information about the Comp.unix.wizards mailing list