Description
|
Report programs can communicate with CSS in three different ways: 1.) Lpr-Parameter Lpr parameters may be set in the first line of a print file (document embedded control). Free format: Position |
Content |
1..7 |
'++CSS++' / CSS parameter identification |
8..n |
any lpr(U) options |
The parameter record must be terminated by a carriage return or linefeed. This
format should be favored, since it allows to specify all possible lpr(U)
options.
Example:
++CSS++ -a -fB -d Laser1 -t 'Invoices' |
Fixed format:
Position |
Content |
1..9 |
##CSS03## / CSS parameter identification (version 3) |
10..12 |
Form ID |
13..13 |
Form subtype (see also fdu(U)) |
14..14 |
Automatic character pitch selection: Space = no / <> Space = yes |
15..30 |
0..999 / Device number (three digits) / 0 = any device, or device name (16 characters) |
31..32 |
0..99 / number of copies to print / 0 = 'hold' |
33..62 |
Report title |
63..63 |
Disposition after printout: Space, E, e = erase / D, d = keep until date |
64..73 |
Keep date DD.MM.YYYY |
74..81 |
Employee-ID |
82..95 |
Program-ID |
96..107 |
Banner page Title |
The parameter record may be truncated at the right. It must however be terminated by a
carriage return or linefeed.
Example:
This report will be printed on form A4q, device 0 (any system printer (i.e. as
printer)), two copies with automatic character pitch selection.
Example Cobol:
*
* COMMERCIAL-SPOOLING-SYSTEM PARAMETER
*
01 CSS.
02 FILLER
PIC X(9) VALUE
"##CSS03##".
02 CSS-FORM PIC
X(3) VALUE "A".
02 CSS-SUBFORM PIC
X VALUE SPACE.
*
.Form ID
02 CSS-AUTOCPI PIC
X VALUE SPACE.
*
.A = Automatic CPI
*
selection according
*
to the longest line
02 CSS-DEVICE-NAME.
03 CSS-DEVICE PIC
9(3) VALUE ZERO.
03 FILLER
PIC X(13) VALUE SPACE.
*
.Device-ID / -Name
*
0 = Auto-select
02 CSS-COPYS PIC
99 VALUE 1.
*
.Number of copies
*
0 = hold
02 CSS-RNAME PIC
X(30) VALUE SPACE.
*
.Report title
02 CSS-KEEP PIC
X VALUE "E".
*
.E,SPACE = print, erase
*
.D = Keep until date
02 CSS-KDAT PIC
X(10) VALUE SPACE.
*
.Keep date (DD.MM.YYYY)
02 CSS-MKZ
PIC X(8) VALUE SPACE.
*
.Employee-ID
02 CSS-PGMNAME PIC X(14)
VALUE SPACE.
*
.Program name
02 CSS-BANNER PIC
X(12) VALUE SPACE.
*
.Banner page text
* *****END CSS.P
.....
MOVE "A" TO CSS-AUTOCPI.
MOVE 2 TO CSS-COPYS.
MOVE "Customer Report" TO CSS-RNAME.
OPEN OUTPUT R0.
WRITE R0-LINE FROM CSS AFTER 0.
..... |
The parameter format of previous CSS versions (##CSS##, ##CSS01##
and ##CSS02##) are still supported.
2.) Escape Sequences
As described in css.devices(C), the various
printer options may be controlled by the Esc controls Esc,1 to Esc,127 (e1..e127).
Example Basic:
10 REM ELONGATED PRINTING
20 LPRINT CHR$(27); CHR$(9); "wide Text"
30 LPRINT CHR$(27); CHR$(10); "normal Text" |
Example Cobol:
*
* CSS-CONTROL
*
01 CSS-CONTROL.
02 CSS10CPI.
03 FILLER
PIC 9(4) COMP-1 VALUE 6913.
*
.=ESC,1
*
.=(27 * 256) + 1
02 CSS12CPI.
03 FILLER
PIC 9(4) COMP-1 VALUE 6914.
02 CSS16CPI.
03 FILLER
PIC 9(4) COMP-1 VALUE 6915.
02 CSS18CPI.
03 FILLER
PIC 9(4) COMP-1 VALUE 6916.
......
02 CSSEL.
03 FILLER
PIC 9(4) COMP-1 VALUE 6921.
02 CSSNOEL.
03 FILLER
PIC 9(4) COMP-1 VALUE 6922.
......
WRITE R0-LINE FROM CSSEL AFTER 0.
MOVE "Elongated Text" TO R0-LINE.
WRITE R0-LINE AFTER 1.
WRITE R0-LINE FROM CSSNOEL AFTER 0.
MOVE "Normal Text" TO R0-LINE.
WRITE R0-LINE AFTER 1. |
Example C:
/* eprint: print stdin elongated */
#include "css.h"
#define CSS(f,p) fprintf(f, "\033%c", p)
#define ELON 9
#define ELOFF 10
char *progName;
char *lpr = "lpr -p eprint";
main(argc, argv)
int argc;
char *argv[];
{
FILE *pFp, *popen();
register int c;
progName = argv[0];
if ((pFp = popen(lpr, "w")) == NULL)
{
fprintf(stderr, "%s: can't run %s\n",
progName, lpr);
exit(1);
}
CSS(pFp, ELON); /* start elong. */
while ((c = getchar()) != EOF)
putc(c, pFp);
CSS(pFp, ELOFF); /* stop elong. */
pclose(pFp);
return 0;
} |
3.) Form Information
The form capabilities that have been defined in css.forms(C)
may be referenced by the use of the CSS C interface. In combination with the
automatic character pitch selection, it is thus possible to develop programs that are
independent from the physical form size:
#include "css.h"
struct css_forminfo *cfi;
int ps; /* page size */
if (cfi = css_formstat("b"))
ps = cfi->cfi_ps;
else
/* unknown form, use default */
ps = 48; |
The command line of the compilation must include the object module css_fstat.o:
cc -o prog prog.c css_fstat.o ...
The distribution for systems with small-, medium- and large-compilers contains all
three modules. The compiler model is indicated a file prefix S, M and L. |