1 /*-------------- Telecommunications & Signal Processing Lab ---------------
2 McGill University
3
4 Routine:
5 int STdecNfloat (const char String[], int Nmin, int Nmax, float Fval[],
6 int *N)
7
8 Purpose:
9 Decode float values (variable number)
10
11 Description:
12 This routine decodes a string containing numeric data. Multiple data items
13 data items in the string are separated by commas or white-space (as defined
14 by the isspace routine). The decoded data is stored as float values. If
15 the number of data values in the string is less than a given minimum number
16 or a decoding error is detected, an error message is printed and an error
17 indication is returned. A warning messages is printed if extra data follows
18 the requested values (this data is ignored).
19
20 Parameters:
21 <- int STdecNfloat
22 Error status,
23 0 - no error
24 1 - error, too few values or data format error
25 2 - warning, data values too large or too small
26 -> const char String[]
27 Input string
28 -> int Nmin
29 Minimum number of values to be read (may be zero)
30 -> int Nmax
31 Maximum number of values to be read
32 <- float Fval[]
33 Array of Nmax elements used to store the decoded values. Only the first
34 N values are modified.
35 <- int *N
36 Actual number of values decoded. In the case of an error, N indicates
37 the number of values successfully decoded. In that case, N may be less
38 than Nmin.
39
40 Author / revision:
41 P. Kabal Copyright (C) 2003
42 $Revision: 1.22 $ $Date: 2003/05/09 03:02:44 $
43
44 -------------------------------------------------------------------------*/
45
46 #include <libtsp.h>
47 #include <libtsp/nucleus.h>
48
49
50 int
STdecNfloat(const char String[],int Nmin,int Nmax,float Fval[],int * N)51 STdecNfloat (const char String[], int Nmin, int Nmax, float Fval[], int *N)
52
53 {
54 return (STdecNval (String, Nmin, Nmax, 'F', (void *) Fval, N));
55 }
56