C0CCCR0 ; CCDCCR/GPL - CCR TEMPLATE AND ACCESS ROUTINES; 5/31/08 ;;1.2;C0C;;May 11, 2012;Build 46 ;Copyright 2008,2009 George Lilly, University of Minnesota. ;Licensed under the terms of the GNU General Public License. ;See attached copy of the License. ; ;This program is free software; you can redistribute it and/or modify ;it under the terms of the GNU General Public License as published by ;the Free Software Foundation; either version 2 of the License, or ;(at your option) any later version. ; ;This program is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;GNU General Public License for more details. ; ;You should have received a copy of the GNU General Public License along ;with this program; if not, write to the Free Software Foundation, Inc., ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ; W "This is a CCR TEMPLATE with processing routines",! W ! Q ; ZT(ZARY,BAT,LINE) ; private routine to add a line to the ZARY array ; ZARY IS PASSED BY NAME ; BAT is a string identifying the section ; LINE is a test which will evaluate to true or false ; I '$G(@ZARY) D ; ; . S @ZARY@(0)=0 ; initially there are no elements ; . W "GOT HERE LOADING "_LINE,! N CNT ; count of array elements S CNT=@ZARY@(0) ; contains array count S CNT=CNT+1 ; increment count S @ZARY@(CNT)=LINE ; put the line in the array ; S @ZARY@(BAT,CNT)="" ; index the test by battery S @ZARY@(0)=CNT ; update the array counter Q ; ZLOAD(ZARY,ROUTINE) ; load tests into ZARY which is passed by reference ; ZARY IS PASSED BY NAME ; ZARY = name of the root, closed array format (e.g., "^TMP($J)") ; ROUTINE = NAME OF THE ROUTINE - PASSED BY VALUE K @ZARY S @ZARY="" S @ZARY@(0)=0 ; initialize array count N LINE,LABEL,BODY N INTEST S INTEST=0 ; switch for in the TEMPLATE section N SECTION S SECTION="[anonymous]" ; NO section LABEL ; N NUM F NUM=1:1 S LINE=$T(+NUM^@ROUTINE) Q:LINE="" D . I LINE?." "1";".E S INTEST=0 ; leaving section . I INTEST D ; within the section . . I LINE?." "1";><".E D ; sub-section name found . . . S SECTION=$P($P(LINE,";><",2),">",1) ; pull out name . . I LINE?." "1";;".E D ; line found . . . D ZT(ZARY,SECTION,$P(LINE,";;",2)) ; put the line in the array Q ; LOAD(ARY) ; LOAD A CCR TEMPLATE INTO ARY PASSED BY NAME D ZLOAD(ARY,"C0CCCR0") ; ZWR @ARY Q ; ;