Hello Jacob !
Replying to a message of Jacob Warner to David Noon:
JW> In IBM's PL/I is there any way to send control characters to screen or
JW> printer? To be specific in C one can use the following #define
JW> YELLOWONBLUE '\1b[33;44m' and the ANSI commands work to make yellow text
JW> on blue background. In the CP/M version of PL/I there was a similar
JW> command %replace which could be used to send commands (including ESCAPE}
JW> to the printer. In BASIC and Modula-2 it is easy to use the ANSI to make
JW> red boxes on blue screens, etc. If such a capability is in PL/I, I
JW> cannot find it, but I find it hard to believe that IBM made no such
JW> provision. -!- Maximus/2 2.01wb ! Origin: OS/2 Shareware BBS, Fairfax,
JW> VA: 703-385-4325 (1:109/347)
Here is a set of Vio - Routines in PL/I
Very Quick and very Dirty :-)))
---------------------------------Schnipp schnapp--------------------------------
%if cfwwrite_ = 'Y' %then %do;
cfwwrite: proc (row,col,string) Options(inline);
dcl row ushort;
dcl col ushort;
dcl string char(5200) var byvalue;
dcl str char(length(string)) init(string);
dcl krc ushort;
krc = VioWrtCharStrAttr(addr(str),length(string),row,col,addr(##Attrib),0);
end cfwwrite;
SetCursor: Proc(state) Options(inline);
dcl state char(3) var byvalue;
dcl
1 PvioCursorInfo,
2 startline ushort init(6),
2 endline ushort init(7),
2 cursorwidth ushort init(1),
2 cursorattrib sshort init(0);
dcl krc ushort;
krc = VioGetCurType(Addr(PvioCursorInfo),0);
dcl cmd char(3) var init(upper(state));
select(cmd);
when ('OFF') do;
cursorattrib = -1;
startline = 6;
end;
when ('ON' ) cursorattrib = 0 ;
when ('INS') do;
if Startline ^= 6
then
startline = 6;
else
startline = 2;
end;
otherwise ;
end;
krc = VioSetCurType(addr(PvioCursorInfo),0);
end SetCursor;
%end;
%if cfwinput_ = "Y" %then %do;
CfwInput: Proc(y,x,L,String) returns(char(4000) var) Options(inline);
dcl (x,y,l) ushort ;
dcl string char(4000) var byvalue;
dcl work char(l) init(' ');
dcl (x1,y1,p1) ushort ;
dcl ll ushort ;
dcl rc ushort ;
dcl IoWait ushort init(0) ;
DCL HKBD USHORT init(0) ;
dcl ENTER char(1) value ('0D'X) ;
dcl BACKSPACE char(1) value ('08'X) ;
dcl EXT char(1) value ('E0'X) ;
dcl CNULL char(1) value ('00'X) ;
dcl CURLEFT char(1) value ('4B'X) ;
dcl CURRIGHT char(1) value ('4D'X) ;
dcl DEL char(1) value ('53'X) ;
dcl INS char(1) value ('52'X) ;
dcl ERASE char(1) value ('75'X) ;
dcl POS1 char(1) value ('47'X) ;
dcl END char(1) value ('4F'X) ;
dcl insstate bit (1) init ('0'B) ;
work = copy(' ',l) ;
call SetCursor('ON') ;
ll = length(trim(string,'',' '));
x1 = x+ll ;
substr(work,1,ll) = string ;
y1 = y ;
p1 = ll +1 ;
do forever ;
call cfwwrite(y,x,work) ;
rc = VioSetCurpos(y1,x1,0) ;
rc = CharIn(addr(#PKBDKEYINFO),
0 ,
0 ) ;
select;
when (ASCIICHARINFO >= ' '
& ASCIICHARINFO >') do;
if (^insstate)
then
do;
substr(work,p1,1) = ASCIICHARINFO;
x1 = x1 + 1*(p11) ;
p1 = p1 - 1*(p1>1) ;
end;
when (( ASCIICHARINFO = EXT
|ASCIICHARINFO = CNULL)
& Scancode = curleft) do;
x1 = x1 - 1*(p1>1) ;
p1 = p1 - 1*(p1>1) ;
end;
when (( ASCIICHARINFO = EXT
|ASCIICHARINFO = CNULL)
& Scancode = curright) do;
x1 = x1 + 1*(p1 * Origin: Charisma OS2HELP Backbone Host 2 (2:2476/14.3)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 949 712/353 623 713/888 800/1
@PATH: 2476/14 2 2480/76 24/24 396/1 3615/50 229/2 12/2442
@PATH: 711/409 54/54 711/808 809 934
|