!++ ! ACCOUNTING.R32 ! ! Copyright (c) 2008, Matthew Madison. ! ! All rights reserved. ! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: ! ! * Redistributions of source code must retain the above ! copyright notice, this list of conditions and the following ! disclaimer. ! * Redistributions in binary form must reproduce the above ! copyright notice, this list of conditions and the following ! disclaimer in the documentation and/or other materials provided ! with the distribution. ! * Neither the name of the copyright owner nor the names of any ! other contributors may be used to endorse or promote products ! derived from this software without specific prior written ! permission. ! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ! Definitions for accounting log macros. ! ! UPDATE HISTORY: ! ! 04-OCT-1990 V1.0 Madison Initial coding. ! 11-FEB-1991 V1.1 Madison Append to existing accounting file. ! 28-NOV-2000 V1.2 Madison Fix multiple newfiles. !-- MACRO ACC_DEFINE = GLOBAL ACC_OPENED, ACC_CUR_FILVER : INITIAL (0), ACC_FAB : $FAB_DECL, ACC_RAB : $RAB_DECL, ACC_BUF : VECTOR [1024,BYTE]; EXTERNAL ROUTINE MX_ACC_INIT %, ACC_REF = EXTERNAL ACC_OPENED, ACC_CUR_FILVER, ACC_FAB : $FAB_DECL, ACC_RAB : $RAB_DECL, ACC_BUF : VECTOR [,BYTE] %, ACC_INIT (FSPEC, DSPEC, NEWFILE) = MX_ACC_INIT (FSPEC, DSPEC, NEWFILE) %, ACC_LOG (CTRSTR) [] = BEGIN IF .ACC_OPENED NEQ 0 THEN BEGIN %IF %NULL (%REMAINING) %THEN BIND _T = %ASCID CTRSTR : BLOCK [,BYTE]; ACC_RAB [RAB$L_RBF] = ._T [DSC$A_POINTER]; ACC_RAB [RAB$W_RSZ] = ._T [DSC$W_LENGTH]; %ELSE LOCAL _T : BLOCK [DSC$K_S_BLN,BYTE]; INIT_SDESC (_T, 1024, ACC_BUF); $FAO (%ASCID CTRSTR, ACC_RAB [RAB$W_RSZ], _T, %REMAINING); ACC_RAB [RAB$L_RBF] = ACC_BUF; %FI $PUT (RAB=ACC_RAB); END; END%, ACC_FLUSH = $FLUSH (RAB=ACC_RAB)%, ACC_CLOSE = BEGIN IF .ACC_OPENED THEN BEGIN $DISCONNECT (RAB=ACC_RAB); $CLOSE (FAB=ACC_FAB); ACC_OPENED = 0; END; END%;