ba237a9d91
Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunti i sorgenti per Greenleaf Math Library (gfm.dll) git-svn-id: svn://10.65.10.50/trunk@10079 c028cbd2-c16b-5b4b-a496-9718f37d4682
78 lines
1.2 KiB
C
Executable File
78 lines
1.2 KiB
C
Executable File
/* DEC *FindMaximumDecimalArray(pDst, pSrc, size)
|
|
*
|
|
* ARGUMENT
|
|
* DEC *pSrc[];
|
|
* DEC *pDst;
|
|
* int size;
|
|
*
|
|
* DESCRIPTION
|
|
* Given size DEC pointers stored in the array pSrc, finds the maximum
|
|
* element and stores that value in pDst.
|
|
*
|
|
* SIDE EFFECTS
|
|
* None.
|
|
*
|
|
* RETURNS
|
|
* Returns GM_NULL on error, otherwise pDst.
|
|
*
|
|
* POSSIBLE ERROR CODES
|
|
*
|
|
* GM_NULLPOINTER
|
|
* GM_ARGVAL (when size is 0)
|
|
*
|
|
* AUTHOR
|
|
* AA 9-8-87 10:45
|
|
* Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved.
|
|
*
|
|
* MODIFICATIONS
|
|
*
|
|
*
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "gm.h"
|
|
#include "gmsystem.h"
|
|
|
|
DEC *FindMaximumDecimalArray(pDst, pSrc, size)
|
|
DEC *pSrc[];
|
|
DEC *pDst;
|
|
int size;
|
|
{
|
|
int i,wRetVal,max;
|
|
DEC *pm;
|
|
|
|
_MacStart(GM_MAXARR);
|
|
|
|
_MacOutVarD(pDst);
|
|
|
|
if (!pSrc) {
|
|
_MacErr(GM_NULLPOINTER);
|
|
_MacRet(GM_NULL);
|
|
}
|
|
|
|
if (size<=0) {
|
|
_MacErr(GM_ARGVAL);
|
|
_MacRet(GM_NULL);
|
|
}
|
|
|
|
for (i=0; i<size; i++) {
|
|
_MacInVarD(pSrc[i]);
|
|
}
|
|
|
|
/* initialize the offset into the array of pointers */
|
|
max=0;
|
|
i=1;
|
|
|
|
/* stop when the current ptr points to a NULL value */
|
|
while(i<size) {
|
|
wRetVal=CompareDecimal(pSrc[max],pSrc[i]);
|
|
if(wRetVal<0)
|
|
max=i;
|
|
i++;
|
|
}
|
|
|
|
pm = pSrc[max];
|
|
_MacDCopy(pDst,pm);
|
|
_MacRet(pDst);
|
|
}
|