VistA-hash/VWHSH0.m

37 lines
1.4 KiB
Mathematica
Raw Normal View History

2010-01-26 22:53:53 -05:00
VWHSH0 ;;GpZ; - ; IMPROVED HASHING UTILITY: MAIN INSTALL MODULE; 01/08/2010
V ;;8.0;KERNEL;;Jul 10, 1995
;; VWHSH
CHECK ;;
N %S,%D,%ZR,HSH,HASH,HASHLIST,MUMPS,OS,PATH,SCR,ZTOS
DO
. IF $$EN^XUSHSH("TEST")="TEST" S HASH="NONE" QUIT
. S HASH=$P($G(^%ZOSF("HASHLIST")),"|") ; ID installed HASH from earlier version.
. S HASH=$S($$EN^XUSHSH("TEST")="TEST":"NONE",$L($G(HASH))>0:HASH,1:"LEGACY") ; query current XUSHSH
DO DEFHASH
IF HASHLIST'[" MD5 " S ABORT="gpg FAILURE; CHECK for gnupg dependency & its PATH" GOTO ABORT
S %S=$S(ZTOS=8:"VWHSHGTM",HASHLIST["Linux":"VWHSHCLX",1:"VWHSHCWN")
S %D="XUSHSH",U="^",SCR="I 1"
IF $T(^VWHSHLEG)="" S %S="XUSHSH^"_%S,%D="VWHSHLEG^"_%D
; preserve old ^XUSHSH as ^VWHSHLEG
S U="^",SCR="I 1"
DO MOVE^ZTMGRSET
QUIT
;
DEFHASH ;; Entry point for changing default hash.
IF '$L($G(HASH)) DO
. S HASH=$P($G(^%ZOSF("HASHLIST")),"|")
. QUIT:$L($G(HASH))
. S:$T(^VWHSHLEG)>"" HASH=$S($$EN^VWHSHLEG("TEST")="TEST":"NONE",1:"LEGACY")
. QUIT:$L($G(HASH))
. S HASH="LEGACY" ; hard-coded default hash is LEGACY
. QUIT
S HASH=$TR(HASH,"abcdefghijklmnopqrstuvwxyz- ","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
S MUMPS=^%ZOSF("OS"),ZTOS=$S(MUMPS["GT.M":8,MUMPS["OpenM":3)
; SHOULD ERROR IF neither GTM nor Cache.
S HASHLIST=HASH_"||"_$$INIT^@("VWHSH"_ZTOS)()
S ^%ZOSF("HASHLIST")=HASHLIST
QUIT
;
ABORT ;; Failed to find gpg hashes.
U 0 W !,ABORT,! W $G(^%ZOSF("HASHLIST")),!