ftp.nice.ch/pub/next/unix/developer/plplot.3.0.s.tar.gz#/plplot/src/plform.c

This is plform.c in view mode; [Download] [Up]

/* Formats a floating point value in one of the following formats   */
/* (i)  If mode == 0, use floating point format with "precision"    */
/*      places after the decimal point.                             */
/* (ii) If mode == 1, use scientific notation with one place before */
/*      the decimal point and "precision" places after.             */

#include "plplot.h"
#include <stdio.h>
#include <math.h>
#ifdef PLSTDC
#include <string.h>
#else
extern char *strcpy();
extern char *strcat();
#endif

static int setpre, precis;

/* Set the number of points written after the decimal point in labels */

void plprec(setp,prec)
int setp, prec;
{
   setpre = setp;
   precis = prec;
}

void plform(value,scal,prec,result)
double value;
int scal, prec;
char *result;
{
   char form[10];
   char temp[30];

   if(setpre)
      prec = precis;

   if(scal)
     value /= pow(10.,(double)scal);
   sprintf(form,"%%.%df",prec);
   sprintf(temp,form,value);
   strcpy(result,temp);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.