source: WorldVistAEHR/trunk/r/MAILMAN-XM/XMCU1.m@ 862

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

initial load of WorldVistAEHR

File size: 1.1 KB
RevLine 
[613]1XMCU1 ;(WASH ISC)/CMW-Encode/Decode String APIs ;04/17/2002 08:30
2 ;;8.0;MailMan;;Jun 28, 2002
3 ; Entry points (DBIA 1136):
4 ; $$ENCODEUP - Convert all "^" to "~U~"
5 ; $$DECODEUP - Convert all "~U~" to "^"
6 ; $$STRAN - Convert all control characters to printable ones
7 ; $$RTRAN - Undo the conversion done by $$STRAN
8 ;
9RTRAN(XXX) ; Extrinsic Function to decode control characters
10 ;Input=STRING
11 ;Output=STRING
12 N XMESC,X,Y,X1,I
13 S XMESC="~"
14 Q:XXX'[XMESC
15 S Y="",X1=XXX
16R1 S I=$F(X1,XMESC) I I=0 S X=Y_X1 G SET
17 S Y=Y_$E(X1,1,I-2)_$C($A($E(X1,I))-64#128),X1=$E(X1,I+1,999) G R1
18SET Q X
19STRAN(XXX) ; Extrinsic Function to encode control characters
20 ;Input=STRING
21 ;Output=STRING
22 N XMESC,Y,X1,I
23 S XMESC="~"
24 S Y="" F I=1:1:$L(XXX) S X1=$E(XXX,I) S Y=Y_$S(X1=XMESC:XMESC_$C(62),X1?1C:XMESC_$C($A(X1)+64#128),1:X1)
25 Q Y
26ENCODEUP(XXX) ; Extrinsic Function to encode "^" into "~U~"
27 ; Input=STRING
28 ; Output=STRING
29 F Q:XXX'[U S XXX=$P(XXX,U)_"~U~"_$P(XXX,U,2,999)
30 Q XXX
31DECODEUP(XXX) ; Extrinsic Function to decode "~U~" to "^"
32 ; Input=STRING
33 ; Output=STRING
34 F Q:XXX'["~U~" S XXX=$P(XXX,"~U~")_"^"_$P(XXX,"~U~",2,999)
35 Q XXX
Note: See TracBrowser for help on using the repository browser.