PARAM

NAME

param, params - decode parameter definition out of string

SYNOPSIS


double  param(string,parameter,default)
char    *string;
char    *parameter;
double  default;

char    *params(string,parameter,default)
char    *string;
char    *parameter;
char    *default;

DESCRIPTION

param provides a convenient mechanism for extracting parameters from item histories and parameter lists. The routine is given the address of the string, the name of the parameter and a default value. If the routine finds the substring "<parameter>=" in "string" then it returns the floating point value of the following number. If the substring is not found, the default value is returned. If the substring "<parameter>" is found, the value 1.0 is returned. Valid parameter names begin with an alphabetic character. Valid separator characters are: " ", ",", ";", "(", & ")".

Example calls might be:

	sampfreq = param(item.history,"freq",12800.0);
or
	linkflag = param(item.history,"linked",0.0);

params operates in exactly the same way as param except: (i) if the substring "<parameter>=" is found, the string delimited by the following separator is returned; (ii) if the substring is not found, the default value - a pointer to char - is returned; (iii) if the substring "<parameter>" is found, that very substring is returned;(iv) valid separators do not include whitespace.

An example call might be:

	match = params(item.history,"type",NULL);

VERSION/AUTHOR

1.0 - Mark Huckvale
Fri Jul 09 14:54:18 2004