source: FOIAVistA/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XTLKWIC.m@ 1458

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

initial load of FOIAVistA 6/30/08 version

File size: 1.4 KB
Line 
1XTLKWIC ;IHS/OHPRD/ACC,ALB/JLU,SFISC/JC - KWIC ROUTINE FOR FILE MANAGER ;07/22/93 15:52
2 ;;7.3;TOOLKIT;;Apr 25, 1995
3S N SWB,OSTATE,STATE,LLEN,C,D,I,J,WF,WS,WD,WD2,WL,END,Q
4 S D=%,L=$S($D(JLX):JLX,1:X) K JLX
5 D TOKENIZE S I="" F J=0:0 S I=$O(WT(I)) Q:I="" I ^DD("KWIC")'[("^"_I_"^") S @D=""
6 G QUIT
7K N SWB,OSTATE,STATE,LLEN,C,D,I,J,WF,WS,WD,WD2,WL,END,Q
8 S D=%,L=$S($D(JLX):JLX,1:X) K JLX
9 D TOKENIZE S I="" F J=0:0 S I=$O(WT(I)) Q:I="" I ^DD("KWIC")'[("^"_I_"^") K:'($D(@D)\10) @D
10QUIT K WT,I,J Q
11TOKENIZE ; CONVERT INPUT LINE TO TOKENS ; [ 03/20/86 12:44 PM ]
12 K WT
13 D CONVERT
14 K SWB,OSTATE,STATE,LLEN,C,I,J,WF,WS,WD,WD2,WL,END,Q
15 Q
16 ;
17CONVERT ; DO ACTUAL CONVERSION
18 S SWB="",STATE="SKIP",I=0,LLEN=$L(L)
19CHLOOP S I=I+1
20 I I>LLEN S END=1 D:STATE="SCAN" ENDWORD Q
21 S C=$E(L,I)
22 S OSTATE=STATE
23 I OSTATE="SKIP",C'?1P S STATE="SCAN",WS=I
24 I OSTATE="SCAN",C?1P,C'="-",C'="'" S END=0 D ENDWORD S STATE="SKIP"
25 G CHLOOP
26ENDWORD S WL=I-WS,WD=$E(L,WS,I-1)
27 I WL=1 S SWB=SWB_WD I END S WD=SWB D STOREWD
28 I WL>1 D STOREWD I SWB'="" S WD=SWB,SWB="" D STOREWD
29 Q
30STOREWD ;
31REMQT S J=$F(WD,"'") I J>0 S WD=$E(WD,1,J-2)_$E(WD,J,255) G REMQT
32 I WD'["-" D STOREWD2 Q
33 S WD2="" F J=1:1 S WF=$P(WD,"-",J) Q:WF="" Q:$L(WF)>2 S WD2=WD2_WF
34 I WF="" S WD=WD2 D STOREWD2 Q
35 S WD2=WD F J=1:1 S WF=$P(WD2,"-",J) Q:WF="" S WD=WF D STOREWD2
36 Q
37STOREWD2 ;
38 Q:(WD?1N.E)!(^DD("KWIC")[("^"_WD_"^"))
39 Q:$L(WD)=2&("^IN^OF^AN^IS^AS^AT^IF^IT^ON^OR^BY^"[("^"_WD_"^"))
40 Q:WD?1N.E
41 S WT(WD)=""
42 Q
Note: See TracBrowser for help on using the repository browser.