jbuck@epimass.UUCP (Joe Buck) (07/18/86)
I have a Masscomp 5600 running RTU 3.0 with 1-plane, 1024 by 800
terminals. Masscomp includes a program called scrdump that dumps
the screen image to a file; unfortunately they don't document the
format. I could attempt to decode it, but I thought someone might
have already done the job. I want to convert the scrdump output to
Impress format. If I can't have that, does anyone have a detailed
explanation of the format written by scrdump?
Thanks in advance.
--
- Joe Buck {ihnp4!pesnta,oliveb,csi}!epimass!jbuck
Entropic Processing, Inc., Cupertino, California
[I don't have the answer to that, but I do have another approach.
Please see the followup to this message, and please share your
modifications for Imagen with us, if you get something to work! -sob]masscomp@soma.UUCP@soma.UUCP (Stan Barber, Moderator) (07/18/86)
Here is a program developed by some people here to do screen dumps to
an HP Laser-Jet. The second program (plane.c) produces a screen dump and the
first program (lgraph.c) outputs the dump to the Laser-Jet.
These programs are provided without warrenty of any kind. Please share your
modifications with us and we will share them with other masscomp users.
----
Stan Barber, Moderator
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# lgraph.c
# plane.c
# This archive created: Fri Jul 18 15:16:54 1986
# By: Stan Barber, Moderator (Masscomp Users' Society)
export PATH; PATH=/bin:$PATH
echo shar: extracting "'lgraph.c'" '(4068 characters)'
if test -f 'lgraph.c'
then
echo shar: will not over-write existing file "'lgraph.c'"
else
cat << \SHAR_EOF > 'lgraph.c'
/* LASERGRAPH --- graphics program for HP LaserJet printer */
#include <stdio.h>
#define SUCCESS 0
#define FAILURE (-1)
#define HRES 800 /* LaserJet req: horiz. resol. to be mult. of 8 */
#define VRES 600
#define RESET "\033E"
#define HIRES "\033*t300R"
#define hiRES "\033*t150R"
#define loRES "\033*t100R"
#define LORES "\033*t75R"
#define GRAPHICS "\033*r1A"
#define TEXT "\033*rB"
#define TRANS "\033*b"
#define FER "W"
#define TO "\033&a"
#define ROW "R"
#define COL "C"
#define PAGE "\f"
#define NOPAGE ""
main(argc,argv)
int argc;
char *argv[];
{
int j,
irc = 0,
pr_cnt = 0,
nextarg = 1,
nbytes = HRES/8,
nrows = VRES;
char *byte,
*filename = "stdin",
*pres = HIRES,
*rowstr,
*colstr,
nbytestr[10],
hereis[25],
*endstr = PAGE;
FILE *input = stdin, /* default to stdin */
*laser;
itoa(nbytes,nbytestr);
/* open '/dev/lp' for output as 'laser' */
if( (laser = fopen("/dev/lp","w")) == NULL){
printf("%s: can't open /dev/lp\n",argv[0]);
exit(FAILURE);
}
/* scan command line */
byte = argv[1];
if( *byte == '-' ){
++nextarg;
for( ++byte; *byte != '\0'; byte++){
switch(*byte){
case 'H':
pres = HIRES;
++pr_cnt;
break;
case 'h':
pres = hiRES;
++pr_cnt;
break;
case 'l':
pres = loRES;
++pr_cnt;
break;
case 'L':
pres = LORES;
++pr_cnt;
break;
case 'x':
nbytes = atoi(argv[nextarg])/8;
itoa(nbytes,nbytestr);
++nextarg;
break;
case 'y':
nrows = atoi(argv[nextarg]);
++nextarg;
break;
case 'r':
rowstr = argv[nextarg];
++nextarg;
break;
case 'c':
colstr = argv[nextarg];
++nextarg;
break;
case 'w':
endstr = NOPAGE;
break;
default:
fprintf(stderr,"%s: bad option\n",argv[0]);
exit(FAILURE);
}
}
if( pr_cnt > 1 ){
fprintf(stderr,"%s: options H,h,l,L are",argv[0]);
fprintf(stderr," mutually exclusive\n");
exit(FAILURE);
}
}
/* allocate space for pixel row (nbytes long)*/
if( (byte = (char *) calloc(nbytes,sizeof(char)) ) == NULL ){
printf("%s: can't allocate space for pixel row\n");
exit(FAILURE);
}
/* read files (or stdin) and transfer data to LaserJet */
do {
/* initialize LaserJet, set start position, then set graphics mode */
fprintf(laser,RESET);
fprintf(laser,"%s",pres);
fprintf(laser,TO);
fprintf(laser,"%s",rowstr);
fprintf(laser,ROW);
fprintf(laser,TO);
fprintf(laser,"%s",colstr);
fprintf(laser,COL);
fprintf(laser,GRAPHICS);
/* set up string for byte row transfer */
strcat(hereis,TRANS);
strcat(hereis,nbytestr);
strcat(hereis,FER);
/* if filename given, read from that file instead of stdin */
if( nextarg < argc ) {
filename = argv[nextarg];
if( (input = fopen(filename,"r")) == NULL ){
printf("%s: can't open %s\n",argv[0],filename);
exit(FAILURE);
}
printf("%s: reading %s. \n",argv[0],filename);
++nextarg;
}
else printf("%s: reading stdin. \n",argv[0]);
/* transfer 1 pixel row (nbytes long) at a time to printer */
irc = 1;
while( irc != EOF ){ /* keep on until EOF */
/* read a pixel row */
for( j = 0; j < nbytes; j++){
irc = fscanf(input,"%c",(byte+j));
}
/* transfer pixel row */
fprintf(laser,hereis);
for( j = 0; j < nbytes; j++){
fprintf(laser,"%c",*(byte+j));
}
}
printf("%s: finished with %s.\n",argv[0],filename);
/* send closing formfeed (unless 'w' option chosen), reset LaserJet */
fprintf(laser,TEXT);
fprintf(laser,PAGE);
fprintf(laser,RESET);
}while( nextarg < argc );
/* when all files are processed */
exit(SUCCESS);
}
reverse(s)
char s[];
{
int c,i,j;
for( i=0,j=strlen(s)-1; i<j; i++,j-- ) {
c = s[i];
s[i] = s[j];
s[j] = c;
}
}
itoa(n,s) /* from K&R */
int n;
char s[];
{
int i,sign;
if( (sign=n) < 0) n = -n;
i = 0;
do {
s[i++] = n%10+'0';
}while( (n/=10) > 0 );
if( sign < 0 ) s[i++] = '-';
s[i] = '\0';
reverse(s);
}
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'plane.c'" '(2494 characters)'
if test -f 'plane.c'
then
echo shar: will not over-write existing file "'plane.c'"
else
cat << \SHAR_EOF > 'plane.c'
#include <stdio.h>
#define LEFT 0
#define BOTTOM 0
#define RIGHT 799
#define TOP 599
typedef struct hardware {
int xsize;
int ysize;
int horizspace;
int vertspace;
int fbcount; /* Number of frame buffers */
int nplanes; /* Number of planes */
int systemtype;
} HARDWARE;
/**************************************************************************/
/* p l a n e --- get plane images using mgigetfbdata and write */
/* on a file (default to stdout) for lgraph */
/**************************************************************************/
main(argc,argv)
int argc;
char *argv[];
{
int i,j, /* indices for loops */
nplanes = 0, /* how many planes */
plane[10], /* which planes */
show,work, /* frame buffers */
vport = 2, /* viewport default = 2 */
nbytes; /* # bytes across image */
char *image,*composite; /* ptrs to images */
HARDWARE hardwareinfo; /* device information */
FILE *outfile=stdout; /* deflt to stdout */
/* assign gp and get hardware info */
mgiasngp( 0, 0);
mgigethc((sizeof(hardwareinfo)/sizeof(int)),&hardwareinfo);
/* be sure we can do what was requested */
/* interpret command line */
for( i = 1; i < argc; i++ ) {
plane[i] = atoi( argv[i] );
if(plane[i]>hardwareinfo.nplanes) {
fprintf(stderr,"\n%s: ",argv[0]);
fprintf(stderr,"Plane %d non-existant.\n",plane[i]);
mgideagp();
exit(-1);
}
plane[i] = 2 ^ (plane[i]-1);
++nplanes;
}
/* allocate space for image in memory */
nbytes = (TOP-BOTTOM+1)*(RIGHT-LEFT+1);
image = (char *) calloc( nbytes, sizeof(char));
if(image == NULL) {
fprintf(stderr,"\n%s: ",argv[0]);
fprintf(stderr,"can't allocate enough memory now.\n");
mgideagp();
exit(-1);
}
if(nplanes>1) {
composite = (char *) calloc( nbytes, sizeof(char));
if(composite == NULL) {
fprintf(stderr,"\n%s: ",argv[0]);
fprintf(stderr,"can't allocate enough memory now.\n");
mgideagp();
exit(-1);
}
}
/* get each plane and combine with others */
mgiv(vport); /* set viewport */
mgigetfb(&show,&work); /* get frame buffer status */
for( j = 0; j < nplanes; j++ ){
mgigetfbdata(show,plane[j],LEFT,BOTTOM,RIGHT,TOP,image);
if(nplanes>1){
for( i=0; i < nbytes; i++){
composite[i] |= image[i];
}
}
}
/* release gp for other work */
mgideagp();
/* write image to stdout */
if(nplanes>1) image = composite;
for( i = 0; i < nbytes; i++) fprintf(outfile,"%c",image[i]);
}
SHAR_EOF
fi # end of overwriting check
# End of shell archive
exit 0