/*++++++++++++++
.IDENTIFICATION units.h
.LANGUAGE       C
.AUTHOR         Francois Ochsenbein [CDS]
.ENVIRONMENT    Unix, CDS Catalogues
.KEYWORDS       Description of a Table
.VERSION  4.0	12-Nov-1996: Seperated from "anafile"
.COMMENTS       Interpretation of the Standard Units
---------------*/
#ifndef UNITS_DEF	/* To avoid recursive inclusions   */
#define UNITS_DEF	0

#ifndef _ARGS
#ifdef __STDC__
#define _ARGS(A)	A       /* ANSI */
#else
#define _ARGS(A)	()      /* Traditional */
#define const
#endif
#endif

/* Requires log10, dexp */
#include <math.h>
#ifndef M_LN10
#define M_LN10 2.30258509299404568402
#endif
#define dexp(x) exp(M_LN10*(x))

/* from "units.c" */
int unit_factor  _ARGS((char *symbolic_unit, double *factor));
				/* Return number of bytes interpreted	   */
char  *unit_dim  _ARGS((char *symbolic_unit));	/* MLTAK dimension equat.  */
char  *unit_get  _ARGS((char *symbolic_unit, char *string, double *value));
				/* Return a value, and its unit		   */
char  *unit_get1 _ARGS((char *string, double *value));
char  *unit_si   _ARGS((char *string, double *value));
				/* Return SI Symbol, and SI value */
char   *unitex   _ARGS((char *symbolic_unit, int option));
				/* Option as 0=Explain, 1=SI value, 2=both 
				 * 4=softex */
/* Transformations to compute value in another unit */
double unit_scale _ARGS((char *unit1, char *unit2)) ;
				/* Factor | x2 = unit_scale * x1 (0=error) */
/* More complex transformations: 0=linear, 1=log, 2=exp, 3=inverse, 4=linear 
 *      x2 = a*x1 + b       (linear [0=same dimension, 4=extended transform])
 *      x2 = a*log(x1) + b  (log10 [1])
 *      x2 = dexp(a*x1+b)   (dexp=10^x [2])
 *      x2 = a/n + b        (extended [3]) */
int  unit_scale2   _ARGS((char *unit1, char *unit2, double *a, double *b)); 
double unit_convert _ARGS((char *unit1, char *unit2, double value));
double unit_ghz   _ARGS((char *text));	/* Interprets wavelength/fres */
double unit_um    _ARGS((char *text));	/* Interprets wavelength/fres */
#endif
