DIR03 ;SFISC/MKO-MULTILINE FIELD EDITOR ;12:36 PM 15 Feb 1995
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
F D E X IOXY Q:DIR0DN!$G(DIR0QT)
Q
;
E I $G(DIR0("REP"))&DIR0C>1!(DIR0C>$L(DIR0A)),$S(DIR0LN<DIR0NL:DIR0F,1:DIR0FL)>DX,'$D(DIR0KD) D
. D PREAD^DIR01($S(DIR0LN<DIR0NL:DIR0F,1:DIR0FL)-DX,.DIR0ST,.DIR0CH)
. Q:'$L(DIR0ST)
. I '$G(DIR0("REP")) S DIR0A=DIR0A_DIR0ST
. E S $E(DIR0A,DIR0C,DIR0C+$L(DIR0ST)-1)=DIR0ST
. S DX=DX+$L(DIR0ST),DIR0C=DIR0C+$L(DIR0ST)
E D READ^DIR01(.DIR0CH)
Q:DIR0CH=""
;
I "?^"[DIR0CH,DIR0C=1,'DIR0QU D Q
. D DEOF X IOXY
. S DIR0A="",DIR0QU=1 D REP
D @$S($L(DIR0CH)>1:DIR0CH,$G(DIR0("REP")):"REP",1:"INS")
I DIR0QU,"?^"'[$E(DIR0A)!'$L(DIR0A) S DIR0QU=0,DIR0A="" D CLR
Q
;
REP I DIR0C>DIR0M W $C(7) Q
S DIR0CHG=1
S DIR0A=$E(DIR0A,1,DIR0C-1)_DIR0CH_$E(DIR0A,DIR0C+1,999)
S DIR0C=DIR0C+1
W DIR0CH
I DX<DIR0F S DX=DX+1 Q
S DIR0LN=DIR0LN+1,DY=DY+1,DX=DIR0S Q
Q
;
INS I $L(DIR0A)'<DIR0M W $C(7) Q
S DIR0CHG=1
S DIR0A=$E(DIR0A,1,DIR0C-1)_DIR0CH_$E(DIR0A,DIR0C,999)
W $E(DIR0A,DIR0C,DIR0C+DIR0F-DX)
D
. N DIR0LN,DY,DX
. S DX=DIR0S
. F DIR0LN=DIR0C-1\DIR0L+2:1:$L(DIR0A)\DIR0L+1 D
.. S DY=DIR0R+DIR0LN-1 X I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S DX=DIR0S
. F DIR0LN=DIR0C-1\DIR0L+2:1:$L(%X)\DIR0L+1 D
.. S DY=DIR0R+DIR0LN-1 X IOXY
.. W $E(%X,DIR0LN-1*DIR0L+1,DIR0LN*DIR0L)
Q
;
RPM N DX,DY
I $D(DDS) S DX=IOM-8,DY=IOSL-1 X IOXY
I $G(DIR0("REP")) W "Insert " K DIR0("REP")
E W "Replace" S DIR0("REP")=1
Q
;
KPM I $G(DDGLKPNM) K DDGLKPNM W $P(DDGLED,DDGLDEL,9)
E S DDGLKPNM=1 W $P(DDGLED,DDGLDEL,10)
Q
;
WRT G WRT2^DIR0W
WLT ;
FDL G WLT2^DIR0W
DLW G DLW2^DIR0W
;
HLP ;
NB ;
SEL ;
SV ;
RF ;
NOP W $C(7)
Q
TO I $D(DIR0TO)#2 D @DIR0TO Q
S DTOUT=1
ZM ;
QT ;
EX ;
CL ;
TAB ;
CR S DIR0DN=1
Q
DIR03 ;SFISC/MKO-MULTILINE FIELD EDITOR ;12:36 PM 15 Feb 1995
+1 ;;22.0;VA FileMan;;Mar 30, 1999
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 FOR
DO E
XECUTE IOXY
IF DIR0DN!$GET(DIR0QT)
QUIT
+4 QUIT
+5 ;
E IF $GET(DIR0("REP"))&DIR0C>1!(DIR0C>$LENGTH(DIR0A))
IF $SELECT(DIR0LN<DIR0NL:DIR0F,1:DIR0FL)>DX
IF '$DATA(DIR0KD)
Begin DoDot:1
+1 DO PREAD^DIR01($SELECT(DIR0LN<DIR0NL:DIR0F,1:DIR0FL)-DX,.DIR0ST,.DIR0CH)
+2 IF '$LENGTH(DIR0ST)
QUIT
+3 IF '$GET(DIR0("REP"))
SET DIR0A=DIR0A_DIR0ST
+4 IF '$TEST
SET $EXTRACT(DIR0A,DIR0C,DIR0C+$LENGTH(DIR0ST)-1)=DIR0ST
+5 SET DX=DX+$LENGTH(DIR0ST)
SET DIR0C=DIR0C+$LENGTH(DIR0ST)
End DoDot:1
+6 IF '$TEST
DO READ^DIR01(.DIR0CH)
+7 IF DIR0CH=""
QUIT
+8 ;
+9 IF "?^"[DIR0CH
IF DIR0C=1
IF 'DIR0QU
Begin DoDot:1
+10 DO DEOF
XECUTE IOXY
+11 SET DIR0A=""
SET DIR0QU=1
DO REP
End DoDot:1
QUIT
+12 DO @$SELECT($LENGTH(DIR0CH)>1:DIR0CH,$GET(DIR0("REP")):"REP",1:"INS")
+13 IF DIR0QU
IF "?^"'[$EXTRACT(DIR0A)!'$LENGTH(DIR0A)
SET DIR0QU=0
SET DIR0A=""
DO CLR
+14 QUIT
+15 ;
REP IF DIR0C>DIR0M
WRITE $CHAR(7)
QUIT
+1 SET DIR0CHG=1
+2 SET DIR0A=$EXTRACT(DIR0A,1,DIR0C-1)_DIR0CH_$EXTRACT(DIR0A,DIR0C+1,999)
+3 SET DIR0C=DIR0C+1
+4 WRITE DIR0CH
+5 IF DX<DIR0F
SET DX=DX+1
QUIT
+6 SET DIR0LN=DIR0LN+1
SET DY=DY+1
SET DX=DIR0S
QUIT
+7 QUIT
+8 ;
INS IF $LENGTH(DIR0A)'<DIR0M
WRITE $CHAR(7)
QUIT
+1 SET DIR0CHG=1
+2 SET DIR0A=$EXTRACT(DIR0A,1,DIR0C-1)_DIR0CH_$EXTRACT(DIR0A,DIR0C,999)
+3 WRITE $EXTRACT(DIR0A,DIR0C,DIR0C+DIR0F-DX)
+4 Begin DoDot:1
+5 NEW DIR0LN,DY,DX
+6 SET DX=DIR0S
+7 FOR DIR0LN=DIR0C-1\DIR0L+2:1:$LENGTH(DIR0A)\DIR0L+1
Begin DoDot:2
+8 SET DY=DIR0R+DIR0LN-1
XECUTE IOXY
+9 WRITE $EXTRACT(DIR0A,DIR0LN-1*DIR0L+1,DIR0LN*DIR0L)
End DoDot:2
End DoDot:1
+10 SET DIR0C=DIR0C+1
+11 IF DX<DIR0F
SET DX=DX+1
QUIT
+12 SET DIR0LN=DIR0LN+1
SET DY=DY+1
SET DX=DIR0S
+13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R+DIR0LN-1
+4 QUIT
+5 ;
FDB ;
PP IF DIR0C'>1
QUIT
+1 SET DIR0LN=1
SET DY=DIR0R
SET DX=DIR0S
SET DIR0C=1
+2 QUIT
+3 ;
BS IF DIR0C'>1
QUIT
+1 SET DIR0CHG=1
+2 SET DX=DX-1
SET DIR0C=DIR0C-1
+3 SET DIR0A=$EXTRACT(DIR0A,1,DIR0C-1)_$EXTRACT(DIR0A,DIR0C+1,999)_" "
+4 IF DX<DIR0S
SET DIR0LN=DIR0LN-1
SET DY=DY-1
SET DX=DIR0F
+5 XECUTE IOXY
WRITE $EXTRACT(DIR0A,DIR0C,DIR0C+DIR0F-DX)
+6 Begin DoDot:1
+7 NEW DIR0LN,DY,DX
+8 SET DX=DIR0S
+9 FOR DIR0LN=DIR0C-1\DIR0L+2:1:$LENGTH(DIR0A)\DIR0L+1
Begin DoDot:2
+10 SET DY=DIR0R+DIR0LN-1
XECUTE IOXY
+11 WRITE $EXTRACT(DIR0A,DIR0LN-1*DIR0L+1,DIR0LN*DIR0L)
End DoDot:2
End DoDot:1
+12 SET DIR0A=$EXTRACT(DIR0A,1,$LENGTH(DIR0A)-1)
+13 QUIT
+14 ;
DEL IF DIR0C>$LENGTH(DIR0A)
QUIT
+1 SET DIR0CHG=1
+2 SET DIR0A=$EXTRACT(DIR0A,1,DIR0C-1)_$EXTRACT(DIR0A,DIR0C+1,999)_" "
+3 WRITE $EXTRACT(DIR0A,DIR0C,DIR0C+DIR0F-DX)
+4 Begin DoDot:1
+5 NEW DIR0LN,DY,DX
+6 SET DX=DIR0S
+7 FOR DIR0LN=DIR0C-1\DIR0L+2:1:$LENGTH(DIR0A)\DIR0L+1
Begin DoDot:2
+8 SET DY=DIR0R+DIR0LN-1
XECUTE IOXY
+9 WRITE $EXTRACT(DIR0A,DIR0LN-1*DIR0L+1,DIR0LN*DIR0L)
End DoDot:2
End DoDot:1
+10 SET DIR0A=$EXTRACT(DIR0A,1,$LENGTH(DIR0A)-1)
+11 QUIT
+12 ;
CLR NEW %X
+1 SET DIR0CHG=1
+2 SET %X=DIR0A
+3 IF DIR0A]""
IF DIR0A'=DIR0D
SET DIR0SV=DIR0A
+4 SET DIR0A=$SELECT(DIR0A=DIR0D:DIR0SV,DIR0A="":DIR0D,1:"")
+5 SET %X=DIR0A_$JUSTIFY("",$LENGTH(%X)-$LENGTH(DIR0A))
+6 SET DX=DIR0S
+7 FOR DIR0LN=1:1:$LENGTH(%X)\DIR0L+1
Begin DoDot:1
+8 SET DY=DIR0R+DIR0LN-1
XECUTE IOXY
+9 WRITE $EXTRACT(%X,DIR0LN-1*DIR0L+1,DIR0LN*DIR0L)
End DoDot:1
+10 SET (DIR0C,DIR0LN)=1
SET DY=DIR0R
+11 QUIT
+12 ;
DEOF NEW %X
+1 IF DIR0C>$LENGTH(DIR0A)
QUIT
+2 SET DIR0CHG=1
+3 SET %X=DIR0A
SET DIR0A=$EXTRACT(DIR0A,1,DIR0C-1)
SET %X=DIR0A_$JUSTIFY("",$LENGTH(%X)-$LENGTH(DIR0A))
+4 WRITE $EXTRACT(%X,DIR0C,DIR0C+DIR0F-DX)
+5 Begin DoDot:1
+6 NEW DIR0LN,DY,DX
+7 SET DX=DIR0S
+8 FOR DIR0LN=DIR0C-1\DIR0L+2:1:$LENGTH(%X)\DIR0L+1
Begin DoDot:2
+9 SET DY=DIR0R+DIR0LN-1
XECUTE IOXY
+10 WRITE $EXTRACT(%X,DIR0LN-1*DIR0L+1,DIR0LN*DIR0L)
End DoDot:2
End DoDot:1
+11 QUIT
+12 ;
RPM NEW DX,DY
+1 IF $DATA(DDS)
SET DX=IOM-8
SET DY=IOSL-1
XECUTE IOXY
+2 IF $GET(DIR0("REP"))
WRITE "Insert "
KILL DIR0("REP")
+3 IF '$TEST
WRITE "Replace"
SET DIR0("REP")=1
+4 QUIT
+5 ;
KPM IF $GET(DDGLKPNM)
KILL DDGLKPNM
WRITE $PIECE(DDGLED,DDGLDEL,9)
+1 IF '$TEST
SET DDGLKPNM=1
WRITE $PIECE(DDGLED,DDGLDEL,10)
+2 QUIT
+3 ;
WRT GOTO WRT2^DIR0W
WLT ;
FDL GOTO WLT2^DIR0W
DLW GOTO DLW2^DIR0W
+1 ;
HLP ;
NB ;
SEL ;
SV ;
RF ;
NOP WRITE $CHAR(7)
+1 QUIT
TO IF $DATA(DIR0TO)#2
DO @DIR0TO
QUIT
+1 SET DTOUT=1
ZM ;
QT ;
EX ;
CL ;
TAB ;
CR SET DIR0DN=1
+1 QUIT