home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
EPSON
/
EPSETUP.PAS
Wrap
Pascal/Delphi Source File
|
1990-05-28
|
13KB
|
361 lines
(14081) Mon 21 May 90 13:45
By: Charles Falconer
To: All (part 1
Re: Epson Printer Setup
St: Sent Reply in 14082
------------------------------------------------------------------------------
@MSGID: 1:141/209.1 2658537c
Here is the program that has controlled my printers since about 1983. I know
there was an earlier version too. This is an adaptation of the PascalP code.
============= cut (part 1 or 3) EPSETUP.PAS =============
PROGRAM epsetup(lst, input, output);
(* setup Epson RX80 printer *)
(* By C.B. Falconer. 83/Nov/24. Released to Public Domain. *)
(* 1.1 1 Jan 84 - added double strike, elite chars for RX 80 *)
(* 1.2 6 Apr 84 - init does not cancel double, tabs kept at 8 units *)
(* 1.3 27 Jan 87 - Commands for subscript mode at 13 lpi. *)
(* 1.4 24 Jan 89 - Adapted to TP4 and MSDOS. A second command line *)
(* parameter can set the output file *)
(* $n-,d- no run-time checks nor line nums. *)
CONST
header = 'EPSETUP -commands [prn]';
copyrite = 'Ver. 1.4; for MX/RX/FX printers, by C.B. Falconer';
rx80 = true; (* false to remove RX80 only commands *)
cr = 13;
ff = 12;
TYPE
commands = (init, setform,
compress, elite, pica,
normal, double, little,
halflf, lpi6, lpi7, lpi8, lpi13,
onesheet, multisheet,
tabs, formout, none);
(* declaration order controls execution order and *)
(* thus precedence. Last declared takes effect *)
VAR
command : SET OF commands;
oneliner : boolean;
lst : text;
s : string;
(* 1----------------1 *)
FUNCTION getcommand(VAR s : string) : boolean;
VAR
cmd : commands;
i : integer;
BEGIN (* getcommand *)
i := 1;
IF NOT oneliner THEN BEGIN
s := '';
IF rx80 THEN write(
'I)nit S)etform L)ittle C)ompress E)lite P)ica D)ouble N)ormal ?-')
ELSE write(
'I)nit S)etform C)ompress P)ica D)ouble N)ormal ?-');
readln(s);
{} WHILE (i < length(s)) AND (s[i] = ' ') DO i := succ(i);
IF s[i] = '?' THEN BEGIN
write(
'O)nepage M)ultipg T)abs H)alflf 6)lpi 7)lpi 8)lpi 9)13lpi F)ormout -');
readln(s);
{} WHILE (i < length(s)) AND (s[i] = ' ') DO i := succ(i); END;
END;
command := [];
WHILE (i <= length(s)) AND (s[i] <> ' ') DO BEGIN
cmd := none; (* also provides for "?" returning here *)
s[i] := upcase(s[i]);
CASE s[i] OF
'C': cmd := compress;
'D': cmd := double;
'E': cmd := elite;
'F': cmd := formout;
'H': cmd := halflf;
'I': cmd := init;
'L': cmd := little;
'M': cmd := multisheet;
'N': cmd := normal;
'O': cmd := onesheet;
'P': cmd := pica;
'S': cmd := setform;
'T': cmd := tabs;
'9': cmd := lpi13;
'6': cmd := lpi6;
'7': cmd := lpi7;
'8': cmd := lpi8;
(*$s- non-standard Pascal *)
ELSE (* ignore *);
(*$s+*) END; (* case *)
command := command + [cmd]; i := succ(i); END;
getcommand := command <> [];
END; (* getcommand *)
(* 1----------------1 *)
============== cut (part 2 continues) ==============
--- msged 1.999.6
@SEEN-BY 241/1 2 242/20 244/1 280/0 310/11 500/206 507/1 13 414 440
@SEEN-BY 512/0 1 4 9 11 15 23 26 27 29 32 33 99 102 124 1006 1007
@SEEN-BY 515/1
@PATH: 30185/1 141/888 322/1 13/13 260/330 340 310/11 507/1 512/0
* Origin: Ched Consultants, Hamden CT. voice 203-281-1438 (1:141/209.1)
------------------------------------------------------------------------------
(14082) Mon 21 May 90 13:48
By: Charles Falconer
To: All (part 2
Re: Epson Printer Setup
St: Sent Reply chain 14081 14083
------------------------------------------------------------------------------
@MSGID: 1:141/209.1 26585474
'overprint' procedure has been replaced by a specific <cr> in the output
strings to the printer (for TP).
=========== cut (part 2 of 3) EPSETUP.PAS =========
PROCEDURE setup(verbose : boolean);
(* The overprint procedure suppresses a final line-feed, *)
(* but flushes buffers with a final carriage return. *)
(* Prompt flushes buffers with no cr nor lf. *)
CONST
(* $s- these character definitions are non-standard Pascal *)
si = #15;
dc1 = #17;
dc2 = #18;
dc3 = #19;
dc4 = #20;
esc = #27;
(* $s+*)
VAR
cmd : commands;
BEGIN (* setup *)
command := command - [none]; (* ensure empty *)
cmd := init;
WHILE cmd < none DO BEGIN (* scan in declared order *)
IF cmd IN command THEN BEGIN
write(lst, dc1 {enable}, dc1 {flush any garbage});
CASE cmd OF
init: BEGIN
command := command + [setform, multisheet, compress, normal];
IF verbose THEN
writeln('Initializing for 11 inch page, 3 line skipover');
write(lst, dc2, {cancel condensed chars}
dc4, {cancel enlarged chars}
esc, '2', {std line spacing via dip switch}
esc, 'F', {cancel emphasized printing}
esc, 'T', {cancel any subscript mode}
chr(cr) {terminate line}
); (* pagesize setting sets top of form *)
END;
halflf:
BEGIN
IF verbose THEN writeln('Setting 1/2 line feed @ 6 lpi');
write(lst, esc, 'A', chr(6) {72nds inch/line}, chr(cr));
END;
lpi6:
BEGIN
IF verbose THEN writeln('Setting 6 lines/in, 63 per page');
write(lst, esc, 'A', chr(12) {72nds inch/line}, chr(cr));
END;
lpi7:
BEGIN
IF verbose THEN writeln('Setting 7 lines/in, 76 per page');
write(lst, esc, 'A', chr(10) {72nds inch/line}, chr(cr));
END;
lpi8:
BEGIN
IF verbose THEN writeln('Setting 8 lines/in, 84 per page');
write(lst, esc, 'A', chr(9) {72nds inch/line}, chr(cr));
END;
lpi13:
BEGIN
IF verbose THEN writeln('Setting 13 lines/in, 142 per page');
write(lst, esc, '3', chr(16) {216ths inch/line}, chr(cr));
END;
onesheet:
BEGIN
IF verbose THEN writeln('No paper-out detection');
write(lst, esc, '8', chr(cr));
END;
multisheet:
BEGIN
IF verbose THEN writeln('Paper-out detection');
write(lst, esc, '9', chr(cr));
END;
setform:
BEGIN
IF verbose THEN BEGIN
write('Position paper to top of form, press return');
readln; END;
write(lst, esc, 'C', chr(0), chr(11) {inch pages}
,esc, 'N', chr(3) {lines skipover}
,chr(cr)
); (* pagesize setting sets top of form *)
END;
little: BEGIN
IF rx80 THEN BEGIN
IF verbose THEN writeln('Setting subscript font');
write(lst, esc, 'S', chr(1), chr(cr)); {set subscript} END;
END;
elite:
BEGIN
IF rx80 THEN BEGIN
IF verbose THEN writeln('Setting 96 char. lines');
write(lst, esc ,'M' {set elite chars}
, esc ,'T' {cancel any subscript}
, chr(cr)
);
command := command + [tabs]; END;
END;
========= cut (continues on part 3) ==============
--- msged 1.999.6
@SEEN-BY 241/1 2 242/20 244/1 280/0 310/11 500/206 507/1 13 414 440
@SEEN-BY 512/0 1 4 9 11 15 23 26 27 29 32 33 99 102 124 1006 1007
@SEEN-BY 515/1
@PATH: 30185/1 141/888 322/1 13/13 260/330 340 310/11 507/1 512/0
* Origin: Ched Consultants, Hamden CT. voice 203-281-1438 (1:141/209.1)
------------------------------------------------------------------------------
(14083) Mon 21 May 90 13:51
By: Charles Falconer
To: All (part 3
Re: Epson Printer Setup
St: Sent Reply chain 14082 14084
------------------------------------------------------------------------------
@MSGID: 1:141/209.1 265854ca
=========== cut (part 3) EPSETUP.PAS =========
compress:
BEGIN
IF verbose THEN writeln('Setting 132 char. lines');
IF rx80 THEN write(lst ,esc ,'P' {cancel elite chars}
,esc ,'T' {cancel subscript}
);
write(lst, si, chr(cr)); command := command + [tabs];
END;
pica:
BEGIN
IF verbose THEN writeln('Setting 80 char. lines');
IF rx80 THEN write(lst, esc, 'P' {cancel elite chars}
,esc ,'T' {cancel subscript}
);
write(lst ,dc2 {cancel condensed chars}
,dc4 {cancel enlarged chars}
,esc ,'F' {cancel emphasised print}
,chr(cr)
);
command := command + [tabs];
END;
tabs:
BEGIN
IF rx80 THEN BEGIN
IF verbose THEN writeln('Setting tabs at 8 char interval');
write(lst, esc ,'e0', chr(8) {keep tabs aligned}, chr(cr)); END;
END;
double:
BEGIN
IF verbose THEN
writeln('Setting double strike (letter) mode');
write(lst, esc, 'G', chr(cr));
END;
normal:
BEGIN
IF verbose THEN
writeln('Cancelling double strike (letter) mode');
write(lst, esc, 'H', chr(cr));
END;
formout:
BEGIN
IF verbose THEN writeln('Advancing to top of page');
write(lst, chr(ff));
END;
END; (* case *)
END;
command := command - [cmd]; cmd := succ(cmd); END;
END; (* setup *)
(* 1----------------1 *)
PROCEDURE checkfor(VAR oneliner : boolean);
BEGIN (* checkfor *)
oneliner := false; (* default *)
IF paramcount > 1 THEN assign(lst, paramstr(2));
IF paramcount > 0 THEN BEGIN
s := paramstr(1);
IF s[1] = '-' THEN oneliner := true
ELSE assign(lst, s); END;
END; (* checkfor *)
(* 1----------------1 *)
BEGIN (* epsetup *)
assign(lst, 'PRN');
checkfor(oneliner);
{$i-}
rewrite(lst); {$i+}
IF ioresult <> 0 THEN BEGIN
writeln('Can''t open printer file. Use EPSETUP alone for help');
halt; END;
IF oneliner THEN BEGIN
IF getcommand(s) THEN setup(false); END
ELSE BEGIN
writeln(header); writeln(copyrite); writeln;
writeln('Options may be entered after "-" in command line');
writeln(' Ex: A>epsetup -ed (for elite double-strike)');
writeln('Multiple letters in one command cause multiple actions');
writeln(' ''?'' shows extended commands');
WHILE getcommand(s) DO
WHILE command <> [] DO setup(true); END;
close(lst);
END. (* epsetup *)
========== cut (the end) ==========
--- msged 1.999.6
@SEEN-BY 241/1 2 242/20 244/1 280/0 310/11 500/206 507/1 13 414 440
@SEEN-BY 512/0 1 4 9 11 15 23 26 27 29 32 33 99 102 124 1006 1007
@SEEN-BY 515/1
@PATH: 30185/1 141/888 322/1 13/13 260/330 340 310/11 507/1 512/0
* Origin: Ched Consultants, Hamden CT. voice 203-281-1438 (1:141/209.1)
------------------------------------------------------------------------------
(14084) Mon 21 May 90 14:34
By: Charles Falconer
To: All (conclusion)
Re: Epson Printer Setup
St: Sent Reply to 14083
------------------------------------------------------------------------------
@MSGID: 1:141/209.1 26585fc4
This code can run on many systems, with minimal changes. It is command line or
interactively driven, so it is useful in batch files and such.
My normal printer configuration is set with "EPSETUP -ie8", which gives me over
80 lines per page at 96 columns, on 11 inch forms. Europeans will probably
want to make some small changes for 12 inch forms. Note that, on the RX80 up,
the tab interval is corrected to agree with the font, and that the skip over
perforation is set to 1/2 inch, or 3 lines at 6 lpi.
It does NOT test for printer availability, so you can get an apparent hang.
A questionmark at the prompt yields the second prompt line.
--- msged 1.999.6
@SEEN-BY 241/1 2 242/20 244/1 280/0 310/11 500/206 507/1 13 414 440
@SEEN-BY 512/0 1 4 9 11 15 23 26 27 29 32 33 99 102 124 1006 1007
@SEEN-BY 515/1
@PATH: 30185/1 141/888 322/1 13/13 260/330 340 310/11 507/1 512/0
* Origin: Ched Consultants, Hamden CT. voice 203-281-1438 (1:141/209.1)