[613] | 1 | IBDF19 ;ALB/CJM - ENCOUNTER FORM (compile forms,delete workcopy);NOV 22,1993
|
---|
| 2 | ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
|
---|
| 3 | GARBAGE ;delete unused blocks (belonging to WORKCOPY form)
|
---|
| 4 | N IBJUNK,BLK,CR,FORM
|
---|
| 5 | ;
|
---|
| 6 | ;first delete unused workcopy blocks
|
---|
| 7 | ;find the form=WORKCOPY, used as a work area
|
---|
| 8 | S IBJUNK=+$O(^IBE(357,"B","WORKCOPY",""))
|
---|
| 9 | ;clean up blocks not being used
|
---|
| 10 | S BLK=0 F S BLK=$O(^IBE(357.1,"C",IBJUNK,BLK)) Q:'BLK L +^IBE(357.1,BLK):1 I $T D DLTBLK^IBDFU3(BLK,IBJUNK,357.1) L -^IBE(357.1,BLK)
|
---|
| 11 | W !,"Blocks not belonging to any form have been deleted"
|
---|
| 12 | ;
|
---|
| 13 | ;delete cross-references for compilied forms if the forms have been deleted
|
---|
| 14 | F CR="AT","AC","AG","AU","AB" S FORM=0 F S FORM=$O(^IBE(357,CR,FORM)) Q:'FORM I '$D(^IBE(357,FORM)) K ^IBE(357,CR,FORM)
|
---|
| 15 | W !,"Extraneous cross-references on non-existant forms have been deleted"
|
---|
| 16 | Q
|
---|
| 17 | ;
|
---|
| 18 | ;
|
---|
| 19 | COMPILE ;compiles IBFORM at the form level - leaves blocks already compiled alone
|
---|
| 20 | ;
|
---|
| 21 | ;lock the form while compiling
|
---|
| 22 | Q:'$$LOCKFORM^IBDFU7(IBFORM)
|
---|
| 23 | ;compile it only if not already compiled - it could have been compiled by another process while the form was being locked
|
---|
| 24 | I $$FORMDSCR^IBDFU1C(.IBFORM) I 'IBFORM("COMPILED") D
|
---|
| 25 | .N IBARRAY,IBDEVICE,IBPRINT,DFN,IBCLINIC,IBAPPT,SUB
|
---|
| 26 | .S (IBDEVICE("RASTER"),IBDEVICE("GRAPHICS"))=1
|
---|
| 27 | .S (IBDEVICE("CRT"),IBDEVICE("LISTMAN"),IBAPPT,IBCLINIC,DFN,IBDEVICE("PCL"))=0
|
---|
| 28 | .D UNCMPL(.IBFORM,0)
|
---|
| 29 | .D PRNTPRMS^IBDFU1C(.IBPRINT,0,1,0,1)
|
---|
| 30 | .D ARRAYS^IBDFU1C(.IBFORM,.IBARRAY)
|
---|
| 31 | .K ^TMP("IB",$J,"INTERFACES")
|
---|
| 32 | .S SUB="" F S SUB=$O(IBARRAY(SUB)) Q:SUB="" K @IBARRAY(SUB)
|
---|
| 33 | .D DRWBLKS^IBDF2A
|
---|
| 34 | .S:IBFORM("COMPILED")'="F" IBFORM("COMPILED")=1
|
---|
| 35 | .S $P(^IBE(357,IBFORM,0),"^",5)=IBFORM("COMPILED")
|
---|
| 36 | .; -- if form not scannable and it compiled w/o formtype id...get one
|
---|
| 37 | .I 'IBFORM("SCAN"),IBFORM("COMPILED"),'$P(^IBE(357,IBFORM,0),"^",13) S IBFORM("TYPE")=$$FORMTYPE^IBDF18D(1) I IBFORM("TYPE") S $P(^IBE(357,IBFORM,0),"^",13)=IBFORM("TYPE")
|
---|
| 38 | .S:$P(^IBE(357,IBFORM,0),"^",13) ^IBE(357,"ADEF",$P(^IBE(357,IBFORM,0),"^",13),IBFORM)=""
|
---|
| 39 | .K ^TMP("IB",$J,"INTERFACES"),X,Y,I
|
---|
| 40 | D FREEFORM^IBDFU7(IBFORM)
|
---|
| 41 | ; -- build form spec if form compiled successfully
|
---|
| 42 | I IBFORM("SCAN"),IBFORM("COMPILED"),IBFORM("TYPE") D SCAN^IBDFBKS(IBFORM("TYPE"))
|
---|
| 43 | Q
|
---|
| 44 | ;
|
---|
| 45 | ASKCMPL(IBFORM) ;ask if the form should be compiled or uncompiled
|
---|
| 46 | Q:'$G(IBFORM)
|
---|
| 47 | N BLK,QUIT S QUIT=0
|
---|
| 48 | I $P($G(^IBE(357,IBFORM,0)),"^",5) D
|
---|
| 49 | .W !,"The form is currently compiled. Should it be recompiled?"
|
---|
| 50 | .K DIR S DIR(0)="Y",DIR("B")="YES"
|
---|
| 51 | .D ^DIR K DIR
|
---|
| 52 | .S:$D(DUOUT)!(Y'=1) QUIT=1
|
---|
| 53 | Q:QUIT
|
---|
| 54 | ;uncompile the form
|
---|
| 55 | D UNCMPALL(IBFORM)
|
---|
| 56 | Q
|
---|
| 57 | ;
|
---|
| 58 | CMPLACTN ;action for compiling a form listed on the screen
|
---|
| 59 | N IBFORM
|
---|
| 60 | I $G(IBAPI("SELECT"))'="" X IBAPI("SELECT")
|
---|
| 61 | I IBFORM D ASKCMPL(IBFORM)
|
---|
| 62 | S VALMBCK="R"
|
---|
| 63 | Q
|
---|
| 64 | ;
|
---|
| 65 | KILLTBL(IBFORM) ;
|
---|
| 66 | ; -- marks the FORM DEFINITION TABLE for deletion
|
---|
| 67 | ; IBFORM("TYPE") is reset to "", pass IBFORM by reference
|
---|
| 68 | ;
|
---|
| 69 | Q:'IBFORM("TYPE")
|
---|
| 70 | ;
|
---|
| 71 | ; -- Mark forms for deletion
|
---|
| 72 | S $P(^IBD(357.95,IBFORM("TYPE"),0),"^",2)=DT,^IBD(357.95,"ADEL",DT,IBFORM("TYPE"))=""
|
---|
| 73 | K ^IBE(357,"ADEF",IBFORM("TYPE"),IBFORM) ; kill cross reference
|
---|
| 74 | S IBFORM("TYPE")="",$P(^IBE(357,IBFORM,0),"^",13)=""
|
---|
| 75 | Q
|
---|
| 76 | ;
|
---|
| 77 | UNCMPL(IBFORM,FAILED) ;marks the form as not compiled and deletes or marks for deletion the FORM DEFINITION TABLE
|
---|
| 78 | ;leaves the blocks compiled
|
---|
| 79 | ;if FAILED means compilation of form was attempted, but failed - mark form accordingly
|
---|
| 80 | ;IBFORM is the form - if passed by reference IBFORM("TYPE") and IBFORM("COMPILED") are set
|
---|
| 81 | ;
|
---|
| 82 | Q:'IBFORM
|
---|
| 83 | N NODE
|
---|
| 84 | S NODE=$G(^IBE(357,IBFORM,0))
|
---|
| 85 | S IBFORM("SCAN")=$P(NODE,"^",12),IBFORM("TYPE")=$P(NODE,"^",13)
|
---|
| 86 | D:IBFORM("TYPE") KILLTBL(.IBFORM)
|
---|
| 87 | S IBFORM("COMPILED")=$S($G(FAILED):"F",1:0),$P(^IBE(357,IBFORM,0),"^",5)=IBFORM("COMPILED")
|
---|
| 88 | Q
|
---|
| 89 | ;
|
---|
| 90 | UNCMPALL(IBFORM) ;uncompile the form and it's blocks
|
---|
| 91 | N BLK
|
---|
| 92 | D UNCMPL(IBFORM,0)
|
---|
| 93 | ;also uncompile all of its blocks
|
---|
| 94 | S BLK=0 F S BLK=$O(^IBE(357.1,"C",IBFORM,BLK)) Q:'BLK D UNCMPBLK^IBDF19(BLK)
|
---|
| 95 | Q
|
---|
| 96 | BLKCHNG(FORM,BLOCK) ;call this if the block is edited - uncompiles the block and form
|
---|
| 97 | D UNCMPBLK(BLOCK)
|
---|
| 98 | D UNCMPL(FORM)
|
---|
| 99 | Q
|
---|
| 100 | ;
|
---|
| 101 | UNCMPBLK(BLOCK) ;delete the compiled version of the block
|
---|
| 102 | K ^IBE(357.1,BLOCK,"V"),^IBE(357.1,BLOCK,"S"),^IBE(357.1,BLOCK,"B"),^IBE(357.1,BLOCK,"H")
|
---|
| 103 | Q
|
---|
| 104 | ;
|
---|
| 105 | KILL(TYPE) ;deletes the form definition=TYPE
|
---|
| 106 | K ^IBD(357.95,"AC",TYPE),^IBD(357.95,TYPE,1)
|
---|
| 107 | K ^IBD(357.95,"AD",TYPE),^IBD(357.95,TYPE,2)
|
---|
| 108 | K DA S DIK="^IBD(357.95,",DA=TYPE D ^DIK K DIK,DA
|
---|
| 109 | Q
|
---|
| 110 | ;
|
---|
| 111 | RECMPALL ;causes all forms to be recompiled
|
---|
| 112 | N IBFORM,IBQUIT,DIR,DIRUT,DUOUT,DTOUT
|
---|
| 113 | S IBQUIT=0
|
---|
| 114 | I '$D(ZTQUEUED) D
|
---|
| 115 | .S DIR("?")="Enter 'Yes' to cause all forms to uncompile or 'No' to do nothing. Forms will actually recompile as they are printed."
|
---|
| 116 | .S DIR(0)="Y",DIR("A")="Do you really want to Recompile all Forms"
|
---|
| 117 | .D ^DIR S IBQUIT='Y
|
---|
| 118 | I $G(IBQUIT) W !!,"Okay, nothing recompiled" Q
|
---|
| 119 | ;
|
---|
| 120 | W:'$D(ZTQUEUED) !!,"Uncompiling all forms..."
|
---|
| 121 | S IBFORM=0
|
---|
| 122 | F S IBFORM=$O(^IBE(357,IBFORM)) Q:'IBFORM D
|
---|
| 123 | .Q:'$$LOCKFORM^IBDFU7(IBFORM)
|
---|
| 124 | .D UNCMPALL(IBFORM)
|
---|
| 125 | .D FREEFORM^IBDFU7(IBFORM)
|
---|
| 126 | .W:'$D(ZTQUEUED) "."
|
---|
| 127 | W:'$D(ZTQUEUED) !!,"Okay, forms will be recompiled as they are printed."
|
---|
| 128 | Q
|
---|