BP
signal. If there
are no others, `signal.dat' is 1,500,000 bytes (nsamp
* 1.5
bytes/sample). One-third of the space occupied by `signal.dat' could be
saved if it were converted to format 8. The maximum slew rate
representable in format 8 is 127 adu/sample interval * 100 sample
intervals/sec / 10 adu/mmHg = 1270 mmHg/sec.
your-program | graph | plot
getann
needs
storage for the annotation structure. `t' is declared as an
int
in line 7, which works on a 32-bit machine, but probably not
on a 16-bit machine. Line 11 contains three errors (did you find all of
them?): the first argument to annopen
should be a character
string, not an integer; the second argument should be a pointer
to a DB_Anninfo
object, not the object itself; and (as written)
the `if' condition is satisfied only if annopen
fails (it
returns zero if successful). Line 12 also contains three errors: the
first argument to getann
is the annotator number, but the first
(in this case, the only) input annotator is 0
, not 1
; the
second argument to getann
should be, but is not, a pointer to an
allocated DB_Annotation
structure; and the `while' loop
terminates only if getann
succeeds. There are two errors
in lines 13 and 14: `annot.time' is a long integer (unless
long
is equivalent to int
on your machine, `%d' is an
incorrect specification for printing it); and the functions
timstr
and mstimstr
return pointers to static storage that
is overwritten by each call. If the other errors are fixed, the
printf
statement will print the same string twice (which one
depends on the order of evaluation of function arguments, which may vary
between compilers). Having fixed all of these errors, the output is
still incorrect, since getann
returns rhythm and signal quality
annotations as well as beat labels (only the latter should be used for
calculating R-R intervals), and `t' is not initialized, which makes
the first interval wrong in any case. As for the extra credit question,
the program probably produces nothing at all on its standard output!
If, by some miracle, annopen
succeeds, it returns zero, and the
body of the `if' is never executed. If annopen
simply
fails, perhaps because the input annotation file can't be opened,
getann
also fails, and the program probably dumps core with an
illegal memory reference in the printf
statement, since
annot
hasn't been initialized. More likely, the program will
dump core in annopen
, attempting to reference memory location
100.
Go to the first, previous, next, last section, table of contents.