24 lines
2.2 KiB
Mathematica
24 lines
2.2 KiB
Mathematica
GMRGPNB0 ;CISC/JH/RM-NARRATIVE BUILDER FOR TEXT GENERATOR (cont.) ;6/20/91
|
|
;;3.0;Text Generator;;Jan 24, 1996
|
|
TEXT ; ENTRY WITH GMRGA SET TO POINT AT WHICH WANT TO START BUILDING TEXT
|
|
S (GMRGE0,GMRGADD)=""
|
|
Q:'$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGA0))&GMRGCSW Q:('$D(^GMR(124.3,"B",GMRGA0,GMRGPDA))&'$D(^GMR(124.3,GMRGPDA,1,"B",GMRGA0)))&'GMRGCSW D NOW^%DTC
|
|
S GMRGB0=$O(^GMR(124.3,GMRGPDA,1,"B",GMRGA0,0)) I GMRGB0>0 S GMRGST=GMRGB0,GMRGST(1)=GMRGPDA,GMRGST(2)=$S(GMRGCSW=1:%,1:GMRGPDT) D STAT^GMRGRUT0 S GMRGF0=GMRGSTAT,GMRGST=GMRGB0,GMRGST(1)=GMRGPDA,GMRGST(2)=GMRGPDT D STAT^GMRGRUT0
|
|
I GMRGB0>0 S GMRGE0=$S($P(GMRGSTAT,"^",3)=1:"",$P(GMRGSTAT,"^")=$P(GMRGF0,"^"):$S($D(^GMR(124.3,GMRGPDA,1,GMRGB0,0)):$P(^(0),"^",2),1:""),1:$S($D(^GMR(124.3,GMRGPDA,1,GMRGB0,2,+$P(GMRGSTAT,"^"),0)):$P(^(0),"^",4),1:""))
|
|
I S GMRGADD=$S($P(GMRGSTAT,"^",3)=1:"",$P(GMRGSTAT,"^")=$P(GMRGF0,"^"):$S($D(^GMR(124.3,GMRGPDA,1,GMRGB0,"ADD")):"1;"_GMRGB0_";0",1:""),1:$S($D(^GMR(124.3,GMRGPDA,1,GMRGB0,2,$P(GMRGSTAT,"^"),"ADD")):"1;"_GMRGB0_";2;"_$P(GMRGSTAT,"^"),1:""))
|
|
S GMRGE0(0)=$S($D(^GMRD(124.2,GMRGA0,0)):^(0),1:""),GMRGE0(4)=$S($D(^GMRD(124.2,GMRGA0,4)):^(4),1:""),GMRGE0(5)=$S($D(^GMRD(124.2,GMRGA0,5)):^(5),1:"") Q:$P(GMRGE0(0),"^",2)=3&GMRGSSW
|
|
I "S"[$P(GMRGE0(0),"^",8)!GMRGSSW D SNT^GMRGPNB1 Q
|
|
S GMRGNAR=GMRGPAR_"^"_$P(GMRGE0(0),"^",8)_"^"_GMRGSPC_"^^"_GMRGRM,GMRGNAR(0)=$P(GMRGE0(0),"^")_"^"_GMRGE0,GMRGNAR("LEAD")=GMRGE0(4),GMRGNAR("TRAIL")=GMRGE0(5) D STORETXT^GMRGRUT1
|
|
S GMRGSPC=GMRGSPC+3
|
|
F GMRGD0=0:0 S GMRGD0=$O(^GMRD(124.2,GMRGA0,1,GMRGD0)) Q:GMRGD0'>0 D RECUR
|
|
Q:'GMRGADD
|
|
S GMRGNAR=GMRGPAR_"^T^"_GMRGSPC_"^^"_GMRGRM,GMRGNAR("LEAD")="Additional Text: ",GMRGNAR("TRAIL")=""
|
|
S GMRGNAR(0)=$S('$P(GMRGADD,";",3):^GMR(124.3,GMRGPDA,1,$P(GMRGADD,";",2),"ADD"),1:^GMR(124.3,GMRGPDA,1,$P(GMRGADD,";",2),2,$P(GMRGADD,";",4),"ADD")) D STORETXT^GMRGRUT1
|
|
Q
|
|
RECUR ;
|
|
Q:'$$ALIST^GMRGRUT0(GMRGPDA,GMRGA0,+$G(^GMRD(124.2,+GMRGA0,1,+GMRGD0,0)))
|
|
S ^TMP($J,"GMRGPLVL",GMRGPLVL)=GMRGA0_"^"_GMRGD0_"^"_GMRGSPC_"^"_GMRGSSW_"^"_GMRGADD,GMRGPLVL=GMRGPLVL+1,GMRGA0=$S($D(^GMRD(124.2,GMRGA0,1,GMRGD0,0)):$P(^(0),"^"),1:"")
|
|
D TEXT
|
|
S GMRGPLVL=GMRGPLVL-1,GMRGI0=^TMP($J,"GMRGPLVL",GMRGPLVL),GMRGA0=$P(GMRGI0,"^"),GMRGD0=$P(GMRGI0,"^",2),GMRGSPC=$P(GMRGI0,"^",3),GMRGSSW=$P(GMRGI0,"^",4),GMRGADD=$P(GMRGI0,"^",5)
|
|
Q
|