Metropoli BBS
VIEWER: formate.c MODE: TEXT (ASCII)
/*Copyright (C) 1992, 1994 by Thomas Glen Smith.	All Rights Reserved.*/
/* formate APL2 V1.0.0 *************************************************
* Called from formatm to fill in e-notation widths.				 *
***********************************************************************/
#define INCLUDES APLCB+FORM
#include "includes.h"
int formate(rite,cba)
Aplcb rite,cba;
{
	int *cp,i,*pp,*sp,*wp,wc,wn;

	cp = Chrcb;
	pp = Precb;
	wp = Widcb;
	sp = Signcb;
	for(i = *(cba->apldim + 1) - 1; i > -1; i--)
		if ((*(wp + i) == 0) /* Width specified is zero, and */
		&& (0 > *(pp + i))) { /* precision specified less than zero. */
			wn = 6		/* 1 for decimal point, 1 for "e", */
						/* 1 for sign of exponent,		*/
						/* 2 for exponent, 1 for blank.	*/
				+ *(sp + i) /* 1 for sign */
				- *(pp + i); /* plus number digits in multiplier. */
			wc = 1 + *(cp + i);		/* Maximum char length in col.  */
			*(wp + i) = (wc > wn) ? wc : wn; /* Set column width.	  */
		}
}
[ RETURN TO DIRECTORY ]