Trailing-Edge
-
PDP-10 Archives
-
decuslib10-11
-
43,50527/auxio.bli
There are no other files named auxio.bli in the archive.
Module Auxio(Entries=(Opnchn,Lkpchn,Entchn,Bytein,Byteout,Clschn,Sixochn,Otschn,
Datchn,Crlfchn,Decchn,Octchn),Reserve(1,2,3,4))=
Begin
Require MACHOP.BLI;
Require MACROS.BLI;
Require EXTERN.BLI;
Forward Otschn,Datchn,Crlfchn,Decchn,Octchn;
! These routines are used to manipulate data obtained
! by GETFILE to process unencoded text files. These files
! include: Input files for messages, Output files for copies
!
! These routines all expect to use data found in FILBUF and
! channel IO.
Global routine OPNCHN=
Begin
Filbuf[ffflg] _ 0; ! Ascii data mode
Filbuf[ffbuf] _ Xwd(address(chnobuf),address(chnibuf));
Ifskip OPEN(IO,Address(Filbuf[ffflg])) then return 0;
Print('?M?J?G??MAIDNA Device ');
Sixout(.Filbuf[ffdev],-1);
Print(' not available or doesn''t exist?M?J');
Return -1;
End;
Global routine LKPCHN=
Begin
filbuf[ffprt] _ 0;
Ifskip LOOKUP(IO,Address(filbuf[ffnam])) then return 0;
Error(.Filbuf[ffnam+1]<righthalf>);
Releas(IO);
Return -1;
End;
Global routine ENTCHN=
Begin
Ifskip ENTER(IO,Address(filbuf[ffnam])) then return 0;
Error(.Filbuf[ffnam+1]<righthalf>);
Releas(IO);
Return -1;
End;
Global routine CLSCHN=
Begin
Close(IO);
Releas(IO);
End;
Global routine Bytein=
Begin
While TRUE do
Begin
Chnibuf[2] _ .Chnibuf[2] - 1;
If (.Chnibuf[2] GEQ 0) then Return(Scani(Chnibuf[1]));
Ifskip INUUO(IO) then return -1;
End;
End;
Global routine Byteout(Byte)=
Begin
While TRUE do
Begin
Chnobuf[2] _ .Chnobuf[2] - 1;
If (.Chnobuf[2] GTR 0) then Return(Replacei(Chnobuf[1],.byte));
Ifskip OUTUUO(IO) then return -1;
End;
End;
Global routine Otschn(addr)=
Begin
own iptr,a;
iptr _ Byteptr(.addr);
While TRUE do
Begin
A _ Scani(iptr);
If (.a EQL 0) then return;
Byteout(.a);
End;
End;
Global routine Sixochn(Value,size)=
Begin
own a;
if .size EQL -1 then
decr a from 30 to 0 by 6 do
if .value<.a,6> EQL 0 then return
else Byteout(.value<.a,6>+#40)
else decr a from 30 to 36-(.size*6) by 6 do
Byteout(.value<.a,6>+#40);
End;
Global routine Datchn(time,date,year)=
Begin
Otschn(plit asciz 'Date: ');
If (.date<lefthalf> GTR 12) OR (.date<lefthalf> LEQ 0) then Otschn(plit asciz '????????')
Else
Case .date<lefthalf> of
SET
0;
Otschn(plit asciz 'January ');
Otschn(plit asciz 'February ');
Otschn(plit asciz 'March ');
Otschn(plit asciz 'April ');
Otschn(plit asciz 'May ');
Otschn(plit asciz 'June ');
Otschn(plit asciz 'July ');
Otschn(plit asciz 'August ');
Otschn(plit asciz 'September ');
Otschn(plit asciz 'October ');
Otschn(plit asciz 'November ');
Otschn(plit asciz 'December ');
TES;
Decchn(.date<righthalf>);
Byteout(",");
Decchn(.year);
Otschn(plit asciz ' Time: ');
Decchn(.time/216000);
time _ .time MOD 216000;
Byteout(":");
Decchn(.time/3600);
End;
Global routine Crlfchn=
Begin
Otschn(plit asciz '?M?J');
End;
Global routine Decchn(number)=
Begin
Own num,digits,i;
routine mdiv=
begin
local r;
if .num eql 0 then
return(incr i from 1 to .digits do byteout("0"));
r _ .num mod 10;
digits _ .digits - 1;
num _ .num/10;
mdiv();
byteout(.r+"0");
end;
If (.num LSS 0) then Byteout("-");
num _ abs(.number);
digits _ 2;
mdiv();
end;
Global routine Octchn(number)=
Begin
own i;
i _ 33;
while (.number<.i,3> eql 0) and (.i geq 0) do
i _ .i - 3;
until .i lss 0 do
Begin
byteout(.number<.i,3>+"0");
i _ .i - 3;
end;
end;
End
Eludom