Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: KLASSTU

KLASSTU.m

Go to the documentation of this file.
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