1 | RGUTUU ;CAIRO/DKM - UUEncode and UUDecode functions.;04-Sep-1998 11:26;DKM
|
---|
2 | ;;2.1;RUN TIME LIBRARY;;Mar 22, 1999
|
---|
3 | ;=================================================================
|
---|
4 | ENCODE(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
|
---|
16 | DECODE(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)
|
---|
27 | INIT() Q "=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
---|