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

AICDKWIC.m

Go to the documentation of this file.
  1. AICDKWIC ; KWIC ROUTINE FOR LOOKUP ENGINE ;
  1. ;;4.0;AICD;;DEC 03, 2014;Build 7
  1. S N AICDSWB,AICDOST,AICDST,AICDLLEN,AICDC,AICDD,AICDI,AICDJ,AICDWF,AICDWS,AICDWD,AICDWD2,AICDWL,AICDEND,AICDQ
  1. S AICDD=%,AICDL=X D TOKENIZE S AICDI="" F AICDJ=0:0 S AICDI=$O(AICDWT(AICDI)) Q:AICDI="" I ^DD("KWIC")'[("^"_AICDI_"^") S @AICDD=""
  1. G QUIT
  1. K N AICDSWB,AICDOST,AICDST,AICDLLEN,AICDC,AICDD,AICDI,AICDJ,AICDWF,AICDWS,AICDWD,AICDWD2,AICDWL,AICDEND,AICDQ
  1. S AICDD=%,AICDL=X D TOKENIZE S AICDI="" F AICDJ=0:0 S AICDI=$O(AICDWT(AICDI)) Q:AICDI="" I ^DD("KWIC")'[("^"_AICDI_"^") K:'($D(@AICDD)\10) @AICDD
  1. QUIT K AICDL,AICDWT,AICDI,AICDJ Q
  1. TOKENIZE ; CONVERT INPUT LINE TO TOKENS ; [ 03/20/86 12:44 PM ]
  1. K AICDWT
  1. D CONVERT
  1. K AICDSWB,AICDOST,AICDST,AICDLLEN,AICDC,AICDI,AICDJ,AICDWF,AICDWS,AICDWD,AICDWD2,AICDWL,AICDEND,AICDQ
  1. Q
  1. ;
  1. CONVERT ; DO ACTUAL CONVERSION
  1. S AICDSWB="",AICDST="SKIP",AICDI=0,AICDLLEN=$L(AICDL)
  1. CHLOOP S AICDI=AICDI+1
  1. I AICDI>AICDLLEN S AICDEND=1 D:AICDST="SCAN" ENDWORD Q
  1. S AICDC=$E(AICDL,AICDI)
  1. S AICDOST=AICDST
  1. I AICDOST="SKIP",AICDC'?1P S AICDST="SCAN",AICDWS=AICDI
  1. I AICDOST="SCAN",AICDC?1P,AICDC'="-",AICDC'="'" S AICDEND=0 D ENDWORD S AICDST="SKIP"
  1. G CHLOOP
  1. ENDWORD S AICDWL=AICDI-AICDWS,AICDWD=$E(AICDL,AICDWS,AICDI-1)
  1. I AICDWL=1 S AICDSWB=AICDSWB_AICDWD I AICDEND S AICDWD=AICDSWB D STOREWD
  1. I AICDWL>1 D STOREWD I AICDSWB'="" S AICDWD=AICDSWB,AICDSWB="" D STOREWD
  1. Q
  1. STOREWD ;
  1. REMQT S AICDJ=$F(AICDWD,"'") I AICDJ>0 S AICDWD=$E(AICDWD,1,AICDJ-2)_$E(AICDWD,AICDJ,255) G REMQT
  1. I AICDWD'["-" D STOREWD2 Q
  1. S AICDWD2="" F AICDJ=1:1 S AICDWF=$P(AICDWD,"-",AICDJ) Q:AICDWF="" Q:$L(AICDWF)>2 S AICDWD2=AICDWD2_AICDWF
  1. I AICDWF="" S AICDWD=AICDWD2 D STOREWD2 Q
  1. S AICDWD2=AICDWD F AICDJ=1:1 S AICDWF=$P(AICDWD2,"-",AICDJ) Q:AICDWF="" S AICDWD=AICDWF D STOREWD2
  1. Q
  1. STOREWD2 ;
  1. Q:(AICDWD?1N.E)!(^DD("KWIC")[("^"_AICDWD_"^"))
  1. Q:$L(AICDWD)=2&("^IN^OF^AN^IS^AS^AT^IF^IT^ON^OR^BY^"[("^"_AICDWD_"^"))
  1. Q:AICDWD?1N.E
  1. S AICDWT(AICDWD)=""
  1. Q