This routine transforms a composite, format-containing
ASCII string to an unsigned char array. It is to be used
in conjunction with eviofmtswap to swap the endianness of
composite data.
format code bits <- format in ascii form
[15:14] [13:8] [7:0]
Nnm # 0 #'('
0 0 0 ')'
Nnm # 1 #'i' unsigned int
Nnm # 2 #'F' floating point
Nnm # 3 #'a' 8-bit char (C++)
Nnm # 4 #'S' short
Nnm # 5 #'s' unsigned short
Nnm # 6 #'C' char
Nnm # 7 #'c' unsigned char
Nnm # 8 #'D' double (64-bit float)
Nnm # 9 #'L' long long (64-bit int)
Nnm # 10 #'l' unsigned long long (64-bit int)
Nnm # 11 #'I' int
Nnm # 12 #'A' hollerit (4-byte char with int endining)
NOTES:
1. The number of repeats '#' must be the number between 2 and 63, number 1 assumed by default
2. If the number of repeats is symbol 'N' instead of the number, it will be taken from data assuming 'int32' format;
if the number of repeats is symbol 'n' instead of the number, it will be taken from data assuming 'int16' format;
if the number of repeats is symbol 'm' instead of the number, it will be taken from data assuming 'int8' format;
Two bits Nnm [15:14], if not zero, requires to take the number of repeats from data in appropriate format:
[01] means that number is integer (N),
[10] - short (n),
[11] - char (m)
3. If format ends but end of data did not reach, format in last parenthesis
will be repeated until all data processed; if there are no parenthesis
in format, data processing will be started from the beginnig of the format
(FORTRAN agreement)
- Parameters
-
fmt | null-terminated composite data format string |
ifmt | unsigned short array to hold transformed format |
ifmtLen | length of unsigned short array, ifmt, in # of shorts |
- Returns
- the number of shorts in ifmt[] (positive)
-
-1 to -8 for improper format string
-
-9 if unsigned char array is too small
References debugprint, and MAX.