source: FOIAVistA/trunk/r/ZZREGIONAL-A1C-A5C-CRHD-RGED-RGUT-RGWB-RG/RGUTUU.m@ 1635

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

initial load of FOIAVistA 6/30/08 version

File size: 919 bytes
Line 
1RGUTUU ;CAIRO/DKM - UUEncode and UUDecode functions.;04-Sep-1998 11:26;DKM
2 ;;2.1;RUN TIME LIBRARY;;Mar 22, 1999
3 ;=================================================================
4ENCODE(X) ;
5 N RGZ,RGZ1,RGZ2,RGZ3,RGZ4,RGZ5,RGZ6
6 S RGZ=$$INIT,RGZ1=""
7 F RGZ2=1:3:$L(X) D
8 .S RGZ3=0,RGZ6=""
9 .F RGZ4=0:1:2 D
10 ..S RGZ5=$A(X,RGZ2+RGZ4),RGZ3=RGZ3*256+$S(RGZ5<0:0,1:RGZ5)
11 .F RGZ4=1:1:4 S RGZ6=$E(RGZ,RGZ3#64+2)_RGZ6,RGZ3=RGZ3\64
12 .S RGZ1=RGZ1_RGZ6
13 S RGZ2=$L(X)#3
14 S:RGZ2 RGZ3=$L(RGZ1),$E(RGZ1,RGZ3-2+RGZ2,RGZ3)=$E("==",RGZ2,2)
15 Q RGZ1
16DECODE(X) ;
17 N RGZ,RGZ1,RGZ2,RGZ3,RGZ4,RGZ5,RGZ6
18 S RGZ=$$INIT,RGZ1=""
19 F RGZ2=1:4:$L(X) D
20 .S RGZ3=0,RGZ6=""
21 .F RGZ4=0:1:3 D
22 ..S RGZ5=$F(RGZ,$E(X,RGZ2+RGZ4))-3
23 ..S RGZ3=RGZ3*64+$S(RGZ5<0:0,1:RGZ5)
24 .F RGZ4=0:1:2 S RGZ6=$C(RGZ3#256)_RGZ6,RGZ3=RGZ3\256
25 .S RGZ1=RGZ1_RGZ6
26 Q $E(RGZ1,1,$L(RGZ1)-$L(X,"=")+1)
27INIT() Q "=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Note: See TracBrowser for help on using the repository browser.