/* DEC *SumDecimalArrayPositive(pDst,pSrc,n) * * ARGUMENT * DEC *pDst; * DEC **pSrc; * int n; * * DESCRIPTION * Sets pDst to the sum of the n DEC elements of the array pSrc. * If n is 0, 0 is returned. pDst is unchanged if an error occurs. * Only the positive elements are added. * * SIDE EFFECTS * None. * * RETURNS * Returns pointer to the sum if successful, otherwise * returns GM_NULL. * * POSSIBLE ERROR CODES * * GM_NULLPOINTER * GM_ARGVAL * * AUTHOR * Jared Levy * Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved. * * MODIFICATIONS * */ #include #include "gm.h" #include "gmsystem.h" DEC *SumDecimalArrayPositive(pDst,pSrc,n) DEC *pDst; DEC **pSrc; int n; { int i; DEC *p, dsum, *sum=&dsum; /* source must be supplied !! */ _MacStart(GM_SUMARRP); if (!pSrc||!pDst) { _MacErr(GM_NULLPOINTER); _MacRet(GM_NULL); } if (n<0) { _MacErr(GM_ARGVAL); _MacRet(GM_NULL); } for (i=0; i