KLASSTU ;GLRISC/PDW NEW STUSMAN STUDENT;DEC 18,1990@13:54:58 [ 12/13/94 8:02 AM ]
;;1.0
S U="^" D DT^DICRW S IOP="HOME" D ^%ZIS ;K ^XUTL("XQ",$J)
X ^%ZOSF("TYPE-AHEAD")
S IOP="HOME" D ^%ZIS
ASK ;D HOME^%ZIS
U IO W @IOF,!,"YOU ARE ON DEVICE ",$I
INST W !!,"Please select your Instructor/Class",! K DIC S DIC="^KLAS(1200,",DIC(0)="AEQMZ",D="B",DZ="??" D DQ^DICQ,^DIC K D,DZ G:Y'>0 STOP
S CLNUM=$P(Y(0),"^",3),(DA(1),JOB)=+Y,DIC=DIC_JOB_",""M"",",DIC("S")="I $P(^(0),""^"",5)=""""",DIC(0)="AEQMLZ",DIC("A")="Enter Your Name Please :" S:'$D(^KLAS(1200,JOB,"M",0)) ^(0)="^1200.03^^" D ^DIC G:Y'>0 STOP1
S STUDA=+Y,NAME=Y(0,0),DIE=DIC,DR="3///NOW;5///"_$J_";4///"_IO_";1///"_NAME_" HAS JOINED"_";1///@",DA=+Y D ^DIE K DIC,DR
K DIC S DIC="^KLAS(1200.4,"_CLNUM_",1,",DIC(0)="L",X="NEW",DA(1)=CLNUM S:'$D(^KLAS(1200.4,CLNUM,1,0)) ^(0)="^1200.44^^" D ^DIC
S (SLNUM,DA)=+Y,DR=".01///"_NAME_";1//1;2///NOW;3///NOW",DIE=DIC D ^DIE
S MS=1,K=0,CTRL=1
ST W !!,?15,">>>>> To EXIT the class enter '^' <<<<<",! H 2 U IO(0) W @IOF
S KLWCNT=0,T1=0,KLSTMC=0,LIMIT=1000,TL=$P($H,",",2),X2=0,KEY=0,TYPE=^%ZOSF("TYPE-AHEAD")
CON S X=0 X ^%ZOSF("RM"),^("EOFF"),^("TYPE-AHEAD"),^("TRMON") S TMC=^%ZOSF("TRMRD"),TCK="",XON=0,TK=1,CTRL=1,CC=$C(CTRL),KLEN=0
LOOP ;
I '$D(^KLAS(1200,JOB,"P1")) H 1 G LOOP
S KLMCNT=^KLAS(1200,JOB,"P1")
I $D(^KLAS(1200,JOB,"M",STUDA,"AMSG")) G RMES
G:$D(^KLAS(1200,JOB,"P3")) PURGE I $P($H,",",2)>(TL+45) W " ",$C(8) S TL=$P($H,",",2)
I KEY D KEY
I 'KEY R *Z:0 D:Z=42 VIEW^KLASSTU1 I Z=94 W !,"^",!,"LEAVING THE CLASS",! G EXIT
I KLWCNT=KLMCNT X:('KEY)!(KEY&T1) "H 1",TYPE G LOOP
S:(KLWCNT>(LIMIT-1))&(KLMCNT'=LIMIT) KLWCNT=0
I KLWCNT<KLMCNT S KLDIF=KLMCNT-KLWCNT S:KLDIF>10 KLDIF=10 D SCAN G LOOP
S KLDIF=LIMIT-KLWCNT S:KLDIF>10 KLDIF=10 D SCAN G LOOP
SCAN ;
F K=1:1:KLDIF D:'$D(^KLAS(1200,JOB,"S",KLWCNT+K,0)) DLOOP S B(K)=^KLAS(1200,JOB,"S",KLWCNT+K,0)
F K=1:1:KLDIF W B(K) S KLEN=KLEN+$L(B(K)) I KLEN>800 S KLEN=0 H 2
S KLWCNT=KLWCNT+KLDIF,TL=$P($H,",",2)
Q
DLOOP ;
H:'KEY 1 G:'$D(^KLAS(1200,JOB,"S",KLWCNT,0)) DLOOP
Q
KEY ;
U IO(0) R Z#200:TK S Z=TCK_Z,TCK="",TK=0 I X TMC S TCK=$C(Y) S:Y=CTRL TCK="" G:Y=CTRL CTRL S:Y=27 TK=1
I Z="" S:$P($H,",",2)>(TL+6) TK=1 Q
S TL=$P($H,",",2) I Z'[CC S KLSTMC=$S(KLSTMC<LIMIT:KLSTMC+1,1:0),^KLAS(1200,JOB,"R",KLSTMC,0)=Z,^KLAS(1200,JOB,"R1")=KLSTMC
Q
;-----
CTRL U IO(0) W @IOF," | CTRL-",$C(CTRL+64)," | " R *Z:10 G:Z="" LOOP
I Z=35 X ^%ZOSF("EON") R !,"Enter the new command character ? ",*X:30 X ^%ZOSF("EOFF") Q:X="" S X=X#32 S CTRL=X,CC=$C(CTRL) W !,"COMMAND CHARACTER IS NOW >>CTRL-",$C(64+CTRL),"<<",!,">>ON LINE MODE<<-------",! Q
I Z=43 D ^KLASSTU1 Q ;TAPE FOR STUDENT
S Z=Z#32 W " | CTRL-",$C(Z+64)," | ",! S Z=$C(Z) S:$A(Z)=3 Z=Z_$C(13)
S KLSTMC=$S(KLSTMC<LIMIT:KLSTMC+1,1:0),^KLAS(1200,JOB,"R",KLSTMC,0)=Z,^KLAS(1200,JOB,"R1")=KLSTMC Q
RMES ;
S MSG=$O(^KLAS(1200,JOB,"M",STUDA,"AMSG","")) K ^(MSG) D:MSG="GRAB" GRAB D:MSG="RELEASE" RELEASE K MSG G LOOP
GRAB W !!,"YOU HAVE BEEN GIVEN COMMAND - GO FOR IT !",!," to send 'CTRL-x' use 'CRTL-A' followed by 'x'",!!
W !,"to change the Command Character use 'CTRL-A' followed by '#'",!!
R Z:0 S KEY=1,KLSTMC=0,^KLAS(1200,JOB,"R1")=0 X ^%ZOSF("EOFF") Q
;-----
PURGE G PURGE^KLASSTU1
;-----
RELEASE W !!,"SORRY COMMAND HAS BEEN TAKEN AWAY",! S KEY=0 Q
;-----
EXIT I $D(JOB) S DA(1)=JOB,DIE="^KLAS(1200,JOB,""M"",",DA(1)=JOB,DA=STUDA,DR="1///"_NAME_" HAS LEFT" D ^DIE H 3 S DR=".01///@" D ^DIE
;
STOP W !!,"YOU HAVE BEEN EXITED FROM THE CLASS",!
I $D(CLNUM) S DIE="^KLAS(1200.4,"_CLNUM_",1,",DA=SLNUM,DR="3///NOW" D ^DIE
STOP1 K STUDA,DA,KEY,Y,KLMCNT,KLWCNT,TL,NAME,DIC,DIE,Z,MS,MSG,JOB,LIMIT,DR,DA,DINUM,DIC,X,X2,KLSTMC,CLNUM,SLNUM,DIC,K,T1,Y,C,CC,KLDIF,K,KLEN,KLNS,KLNSC,M,B,OPEX,TC,TCK,TK,TMC,TYPE,XON,KLZZ,CTRL
S X=IOM X ^%ZOSF("RM"),^("EON"),^("TRMOFF")
Q
;----------------------UTILITY CODE--------------------
XRAY D XRAY^KLASDIA Q
XX D XX^KLASDIA Q
STUFF D STUFF^KLASDIA Q
SXRAY D SXRAY^KLASDIA Q
KLASSTU ;GLRISC/PDW NEW STUSMAN STUDENT;DEC 18,1990@13:54:58 [ 12/13/94 8:02 AM ]
+1 ;;1.0
+2 ;K ^XUTL("XQ",$J)
SET U="^"
DO DT^DICRW
SET IOP="HOME"
DO ^%ZIS
+3 XECUTE ^%ZOSF("TYPE-AHEAD")
+4 SET IOP="HOME"
DO ^%ZIS
ASK ;D HOME^%ZIS
+1 USE IO
WRITE @IOF,!,"YOU ARE ON DEVICE ",$IO
INST WRITE !!,"Please select your Instructor/Class",!
KILL DIC
SET DIC="^KLAS(1200,"
SET DIC(0)="AEQMZ"
SET D="B"
SET DZ="??"
DO DQ^DICQ
DO ^DIC
KILL D,DZ
IF Y'>0
GOTO STOP
+1 SET CLNUM=$PIECE(Y(0),"^",3)
SET (DA(1),JOB)=+Y
SET DIC=DIC_JOB_",""M"","
SET DIC("S")="I $P(^(0),""^"",5)="""""
SET DIC(0)="AEQMLZ"
SET DIC("A")="Enter Your Name Please :"
IF '$DATA(^KLAS(1200,JOB,"M",0))
SET ^(0)="^1200.03^^"
DO ^DIC
IF Y'>0
GOTO STOP1
+2 SET STUDA=+Y
SET NAME=Y(0,0)
SET DIE=DIC
SET DR="3///NOW;5///"_$JOB_";4///"_IO_";1///"_NAME_" HAS JOINED"_";1///@"
SET DA=+Y
DO ^DIE
KILL DIC,DR
+3 KILL DIC
SET DIC="^KLAS(1200.4,"_CLNUM_",1,"
SET DIC(0)="L"
SET X="NEW"
SET DA(1)=CLNUM
IF '$DATA(^KLAS(1200.4,CLNUM,1,0))
SET ^(0)="^1200.44^^"
DO ^DIC
+4 SET (SLNUM,DA)=+Y
SET DR=".01///"_NAME_";1//1;2///NOW;3///NOW"
SET DIE=DIC
DO ^DIE
+5 SET MS=1
SET K=0
SET CTRL=1
ST WRITE !!,?15,">>>>> To EXIT the class enter '^' <<<<<",!
HANG 2
USE IO(0)
WRITE @IOF
+1 SET KLWCNT=0
SET T1=0
SET KLSTMC=0
SET LIMIT=1000
SET TL=$PIECE($HOROLOG,",",2)
SET X2=0
SET KEY=0
SET TYPE=^%ZOSF("TYPE-AHEAD")
CON SET X=0
XECUTE ^%ZOSF("RM")
XECUTE ^("EOFF")
XECUTE ^("TYPE-AHEAD")
XECUTE ^("TRMON")
SET TMC=^%ZOSF("TRMRD")
SET TCK=""
SET XON=0
SET TK=1
SET CTRL=1
SET CC=$CHAR(CTRL)
SET KLEN=0
LOOP ;
+1 IF '$DATA(^KLAS(1200,JOB,"P1"))
HANG 1
GOTO LOOP
+2 SET KLMCNT=^KLAS(1200,JOB,"P1")
+3 IF $DATA(^KLAS(1200,JOB,"M",STUDA,"AMSG"))
GOTO RMES
+4 IF $DATA(^KLAS(1200,JOB,"P3"))
GOTO PURGE
IF $PIECE($HOROLOG,",",2)>(TL+45)
WRITE " ",$CHAR(8)
SET TL=$PIECE($HOROLOG,",",2)
+5 IF KEY
DO KEY
+6 IF 'KEY
READ *Z:0
IF Z=42
DO VIEW^KLASSTU1
IF Z=94
WRITE !,"^",!,"LEAVING THE CLASS",!
GOTO EXIT
+7 IF KLWCNT=KLMCNT
IF ('KEY)!(KEY&T1)
XECUTE "H 1"
XECUTE TYPE
GOTO LOOP
+8 IF (KLWCNT>(LIMIT-1))&(KLMCNT'=LIMIT)
SET KLWCNT=0
+9 IF KLWCNT<KLMCNT
SET KLDIF=KLMCNT-KLWCNT
IF KLDIF>10
SET KLDIF=10
DO SCAN
GOTO LOOP
+10 SET KLDIF=LIMIT-KLWCNT
IF KLDIF>10
SET KLDIF=10
DO SCAN
GOTO LOOP
SCAN ;
+1 FOR K=1:1:KLDIF
IF '$DATA(^KLAS(1200,JOB,"S",KLWCNT+K,0))
DO DLOOP
SET B(K)=^KLAS(1200,JOB,"S",KLWCNT+K,0)
+2 FOR K=1:1:KLDIF
WRITE B(K)
SET KLEN=KLEN+$LENGTH(B(K))
IF KLEN>800
SET KLEN=0
HANG 2
+3 SET KLWCNT=KLWCNT+KLDIF
SET TL=$PIECE($HOROLOG,",",2)
+4 QUIT
DLOOP ;
+1 IF 'KEY
HANG 1
IF '$DATA(^KLAS(1200,JOB,"S",KLWCNT,0))
GOTO DLOOP
+2 QUIT
KEY ;
+1 USE IO(0)
READ Z#200:TK
SET Z=TCK_Z
SET TCK=""
SET TK=0
IF $TEST
XECUTE TMC
SET TCK=$CHAR(Y)
IF Y=CTRL
SET TCK=""
IF Y=CTRL
GOTO CTRL
IF Y=27
SET TK=1
+2 IF Z=""
IF $PIECE($HOROLOG,",",2)>(TL+6)
SET TK=1
QUIT
+3 SET TL=$PIECE($HOROLOG,",",2)
IF Z'[CC
SET KLSTMC=$SELECT(KLSTMC<LIMIT:KLSTMC+1,1:0)
SET ^KLAS(1200,JOB,"R",KLSTMC,0)=Z
SET ^KLAS(1200,JOB,"R1")=KLSTMC
+4 QUIT
+5 ;-----
CTRL USE IO(0)
WRITE @IOF," | CTRL-",$CHAR(CTRL+64)," | "
READ *Z:10
IF Z=""
GOTO LOOP
+1 IF Z=35
XECUTE ^%ZOSF("EON")
READ !,"Enter the new command character ? ",*X:30
XECUTE ^%ZOSF("EOFF")
IF X=""
QUIT
SET X=X#32
SET CTRL=X
SET CC=$CHAR(CTRL)
WRITE !,"COMMAND CHARACTER IS NOW >>CTRL-",$CHAR(64+CTRL),"<<",!,">>ON LINE MODE<<-------",!
QUIT
+2 ;TAPE FOR STUDENT
IF Z=43
DO ^KLASSTU1
QUIT
+3 SET Z=Z#32
WRITE " | CTRL-",$CHAR(Z+64)," | ",!
SET Z=$CHAR(Z)
IF $ASCII(Z)=3
SET Z=Z_$CHAR(13)
+4 SET KLSTMC=$SELECT(KLSTMC<LIMIT:KLSTMC+1,1:0)
SET ^KLAS(1200,JOB,"R",KLSTMC,0)=Z
SET ^KLAS(1200,JOB,"R1")=KLSTMC
QUIT
RMES ;
+1 SET MSG=$ORDER(^KLAS(1200,JOB,"M",STUDA,"AMSG",""))
KILL ^(MSG)
IF MSG="GRAB"
DO GRAB
IF MSG="RELEASE"
DO RELEASE
KILL MSG
GOTO LOOP
GRAB WRITE !!,"YOU HAVE BEEN GIVEN COMMAND - GO FOR IT !",!," to send 'CTRL-x' use 'CRTL-A' followed by 'x'",!!
+1 WRITE !,"to change the Command Character use 'CTRL-A' followed by '#'",!!
+2 READ Z:0
SET KEY=1
SET KLSTMC=0
SET ^KLAS(1200,JOB,"R1")=0
XECUTE ^%ZOSF("EOFF")
QUIT
+3 ;-----
PURGE GOTO PURGE^KLASSTU1
+1 ;-----
RELEASE WRITE !!,"SORRY COMMAND HAS BEEN TAKEN AWAY",!
SET KEY=0
QUIT
+1 ;-----
EXIT IF $DATA(JOB)
SET DA(1)=JOB
SET DIE="^KLAS(1200,JOB,""M"","
SET DA(1)=JOB
SET DA=STUDA
SET DR="1///"_NAME_" HAS LEFT"
DO ^DIE
HANG 3
SET DR=".01///@"
DO ^DIE
+1 ;
STOP WRITE !!,"YOU HAVE BEEN EXITED FROM THE CLASS",!
+1 IF $DATA(CLNUM)
SET DIE="^KLAS(1200.4,"_CLNUM_",1,"
SET DA=SLNUM
SET DR="3///NOW"
DO ^DIE
STOP1 KILL STUDA,DA,KEY,Y,KLMCNT,KLWCNT,TL,NAME,DIC,DIE,Z,MS,MSG,JOB,LIMIT,DR,DA,DINUM,DIC,X,X2,KLSTMC,CLNUM,SLNUM,DIC,K,T1,Y,C,CC,KLDIF,K,KLEN,KLNS,KLNSC,M,B,OPEX,TC,TCK,TK,TMC,TYPE,XON,KLZZ,CTRL
+1 SET X=IOM
XECUTE ^%ZOSF("RM")
XECUTE ^("EON")
XECUTE ^("TRMOFF")
+2 QUIT
+3 ;----------------------UTILITY CODE--------------------
XRAY DO XRAY^KLASDIA
QUIT
XX DO XX^KLASDIA
QUIT
STUFF DO STUFF^KLASDIA
QUIT
SXRAY DO SXRAY^KLASDIA
QUIT