campo-sirio/gfm/dzeroarr.c

63 lines
901 B
C
Raw Normal View History

/* DEC **ZeroDecimalArray(dst, n);
*
* ARGUMENT
* DEC **dst;
* int n;
*
* DESCRIPTION
* Sets each element in an array of n DEC pointers to 0 with id 2.
*
* SIDE EFFECTS
* None.
*
* RETURNS
* Returns dst if successful,
* otherwise returns GM_NULLARR.
*
* POSSIBLE ERROR CODES
*
* GM_NULLPOINTER
* GM_ARGVAL
*
* AUTHOR
* Jared Levy
* Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved.
*
* MODIFICATIONS
*
*/
#include <stdio.h>
#include "gm.h"
#include "gmsystem.h"
DEC **ZeroDecimalArray(dst, n)
DEC **dst;
int n;
{
int i;
_MacStart(GM_DZEROARR);
if (n<=0) {
_MacErr(GM_ARGVAL);
_MacRet(GM_NULLARR);
}
if(!dst) {
_MacErr(GM_NULLPOINTER);
_MacRet(GM_NULLARR);
}
/* check that each element of array is allocated */
for (i=0; i<n; i++)
if (!dst[i]) {
_MacErr(GM_NULLPOINTER);
}
else
_MacDZero(dst[i]);
_MacRet(dst);
}