MAGVAF04 ;WOIFO/NST - Utilities for RPC calls ; 11 Mar 2010 4:39 PM
;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
; ++++ Append data from array FROMARR to array TOARR
; and returns the last node (counter) in TOARR
; e.g FROMARR(1)="Line 3"
; FROMARR(2)="Line 4"
;
; TOARR(1)="Line 1"
;
; Result is
; TOARR(1)="Line 1"
; TOARR(2)="Line 3"
; TOARR(3)="Line 4"
APP2ARR(TOARR,FROMARR) ; Append data from array FROMARR to array TOARR
N I,CNT
S CNT=$O(TOARR(""),-1)
S I=""
F S I=$O(FROMARR(I)) Q:I="" D
. S CNT=CNT+1,TOARR(CNT)=FROMARR(I)
. Q
Q CNT
;
; ++++ Returns string with translated special XML characters
;
; e.g. IN="< KVALUE="123" />"
;
; "&" to "&"
; "<" to "<"
; ">" to ">"
; """ to """
;
TRHTML(IN) ; Returns string with translated special XML characters
N A,I,OUT
S OUT=""
F I=1:1:$L(IN) D
. S A=$A(IN,I)
. I $C(A)="""" S OUT=OUT_""" Q
. I $C(A)="&" S OUT=OUT_"&" Q
. I $C(A)="<" S OUT=OUT_"<" Q
. I $C(A)=">" S OUT=OUT_">" Q
. I A<31 S OUT=OUT_""_A_";" Q
. I A>126 S OUT=OUT_""_A_";" Q
. S OUT=OUT_$C(A)
. Q
Q OUT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGVAF04 2223 printed Nov 22, 2024@17:19:26 Page 2
MAGVAF04 ;WOIFO/NST - Utilities for RPC calls ; 11 Mar 2010 4:39 PM
+1 ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ;
+19 ; ++++ Append data from array FROMARR to array TOARR
+20 ; and returns the last node (counter) in TOARR
+21 ; e.g FROMARR(1)="Line 3"
+22 ; FROMARR(2)="Line 4"
+23 ;
+24 ; TOARR(1)="Line 1"
+25 ;
+26 ; Result is
+27 ; TOARR(1)="Line 1"
+28 ; TOARR(2)="Line 3"
+29 ; TOARR(3)="Line 4"
APP2ARR(TOARR,FROMARR) ; Append data from array FROMARR to array TOARR
+1 NEW I,CNT
+2 SET CNT=$ORDER(TOARR(""),-1)
+3 SET I=""
+4 FOR
SET I=$ORDER(FROMARR(I))
if I=""
QUIT
Begin DoDot:1
+5 SET CNT=CNT+1
SET TOARR(CNT)=FROMARR(I)
+6 QUIT
End DoDot:1
+7 QUIT CNT
+8 ;
+9 ; ++++ Returns string with translated special XML characters
+10 ;
+11 ; e.g. IN="< KVALUE="123" />"
+12 ;
+13 ; "&" to "&"
+14 ; "<" to "<"
+15 ; ">" to ">"
+16 ; """ to """
+17 ;
TRHTML(IN) ; Returns string with translated special XML characters
+1 NEW A,I,OUT
+2 SET OUT=""
+3 FOR I=1:1:$LENGTH(IN)
Begin DoDot:1
+4 SET A=$ASCII(IN,I)
+5 IF $CHAR(A)=""""
SET OUT=OUT_"""
QUIT
+6 IF $CHAR(A)="&"
SET OUT=OUT_"&"
QUIT
+7 IF $CHAR(A)="<"
SET OUT=OUT_"<"
QUIT
+8 IF $CHAR(A)=">"
SET OUT=OUT_">"
QUIT
+9 IF A<31
SET OUT=OUT_""_A_";"
QUIT
+10 IF A>126
SET OUT=OUT_""_A_";"
QUIT
+11 SET OUT=OUT_$CHAR(A)
+12 QUIT
End DoDot:1
+13 QUIT OUT