source: FOIAVistA/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCUTIL.m@ 1397

Last change on this file since 1397 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1GMRCUTIL ;SLC/DCM - Utilities for formatting word procesing fields and setting into ^TMP("GMRCR" globals for use by List Manager routines ;4/30/98 10:47
2 ;;3.0;CONSULT/REQUEST TRACKING;**1,4**;DEC 27, 1997
3GSET(LN,GLOB,J1,FLG) ;Set the word processing formatted local array WP() fields into the ^TMP Global.
4 ; LN: Line in the ^TMP global where the data is to be placed. LN is
5 ; incremented and passed back to the calling routine so that it
6 ; can set data into the next global node as needed.
7 ; GLB: The ^TMP global where the data is to be placed.(i.e.,
8 ; ^TMP("GMRCR",$J,"CS").
9 ; J1: The last entry in the WP array. It is passed back to the
10 ; calling routine so that WP(J1) can be concatenated to the next
11 ; line, if necessary
12 ; FLG: If the first line of the the data in WP needs to be formatted
13 ; differently than succeeding lines, FLG signals this fact by
14 ; being passed as FLG=1; otherwise, FLG is passed as FLG=0.
15 S (J,J1)=0 F S J=$O(WP(J)) Q:J="" S DTA=$S('FLG:$E(TAB,1,17)_WP(J),1:WP(J)) S @GLOB@(LN,0)=DTA,LN=LN+1,J1=J,FLG=0
16 K J,DTA
17 Q
18WPFMT(LINE,GMRCSL) ;FORMAT GLOBALS TO PRINT OUT IN A WORD PROCESSING FORMAT
19 ; LINE: The line of text that needs to be broken into 80 column
20 ; or less lines for printing on the screen.
21 ; GMRCSL: This is the desired line length, to break LINE into; i.e.
22 ; 60, 70, or 80 columns (or smaller/larger) for screen display.
23 K WP S WP="" Q:LINE?1.80P F LIN=1:1 D S WP(LIN)=$E(BKLN,1,$L(BKLN)-1) Q:'$L(LINE)
24 .S (BKLN,WRD)="" F I=1:1 S WRD=$P(LINE," ",1) Q:($L(BKLN)+$L(WRD)+1)>GMRCSL S BKLN=BKLN_WRD_" ",LINE=$P(LINE," ",2,256),WRD="" Q:$P(LINE," ",1,30)=""
25 .I $L(LINE),'$L(BKLN) S BKLN=$E(LINE,1,GMRCSL),LINE=$E(LINE,$L(BKLN),$L(LINE))
26 .Q
27 K I,LIN,BKLN,WRD Q
28 ;
29WPSET(GLOBAL,TMPGBL,LINE,LNO,TAB,FLG) ;Set the lines into a the ^TMP global in word-processing format.
30 ; GLOBAL: Global where data is comming from.
31 ; TMPGBL: Global where formatted data is being placed
32 ; LINE: Line is passed because it may contain some data already.
33 ; If it does, it is concatenated to the data from GLOBAL.
34 ; LNO: This is a counter to where the next line of data should
35 ; be set in TMPGLOBAL. It is incremented and passed back
36 ; to the calling routine so it knows where the next piece
37 ; of data is to be placed in TMPGBL.
38 ; TAB: A string of spaces concatenated to the data in TMPGBL
39 ; that acts like a tab character. TAB is passed to GSET.
40 ; FLG: If the first line of data is not tabbed, then FLG is
41 ; passed as FLG=1 and no tab character is concatenated to
42 ; this line. If FLG=0, then the data is tabbed.
43 N LN
44 S (LN,LN1,J1)=0 F S LN=$O(@(GLOBAL)@(LN)) Q:LN=""!(LN?1A.E) S LINE=LINE_@(GLOBAL)@(LN,0) D
45 .I @(GLOBAL)@(LN,0)?1.240" " D WPFMT(LINE,$S('FLG:60,1:70)),GSET(.LNO,TMPGBL,.J1,.FLG) S @(TMPGBL)@(LNO,0)=@(GLOBAL)@(LN,0),LNO=LNO+1 S LINE="" Q
46 .I $O(@(GLOBAL)@(LN)),$O(@(GLOBAL)@(LN))'?1A S LN1=$O(@(GLOBAL)@(LN)) I $S((@(GLOBAL)@(LN1,0))?1.240" ":1,(@(GLOBAL)@(LN1,0))="":1,1:0) D WPFMT(LINE,$S('FLG:60,1:70)),GSET(.LNO,TMPGBL,.J1,.FLG) S LN=LN1,LINE="" Q
47 .I FLG,$L(LINE)<79,$O(@(GLOBAL)@(LN))]"",$O(@(GLOBAL)@(LN))'?1A.E S LN=$O(@(GLOBAL)@(LN)),LINE=LINE_" "_@(GLOBAL)@(LN,0) D WPFMT(LINE,79),GSET(.LNO,TMPGBL,.J1,.FLG) D
48 ..I $O(@(GLOBAL)@(LN))?1A.E S LINE="" Q
49 ..I $O(@(GLOBAL)@(LN))]"",$D(WP(J1)),$L(WP(J1))<60 S LINE=WP(J1)_" ",LNO=LNO-1 Q
50 ..I $D(WP(J1)),$L(WP(J1))>60 S LINE=WP(J1),LNO=LNO-1 Q
51 ..S LINE="" Q
52 .Q:LINE=""
53 .I $L(LINE)>70,FLG S LINE(0)=$E(LINE,1,$F(LINE," ",69)-1),LINE=$E(LINE,$F(LINE," ",69),$L(LINE)),@(TMPGBL)@(LNO,0)=LINE(0),FLG=$S($L(LINE(0)):0,1:1),LNO=LNO+1
54 .D WPFMT(LINE,$S('FLG:60,1:70)),GSET(.LNO,TMPGBL,.J1,.FLG) I $O(@(GLOBAL)@(LN))]"",$D(WP(J1)),$L(WP(J1))<60 S LINE=WP(J1)_" ",LNO=LNO-1,FLG=0
55 .E S LINE=""
56 .Q
57 K J1,LN1,WP Q
Note: See TracBrowser for help on using the repository browser.