File: probe.c

package info (click to toggle)
audacity 2.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 86,844 kB
  • sloc: ansic: 225,005; cpp: 221,240; sh: 27,327; python: 16,896; makefile: 8,186; lisp: 8,002; perl: 317; xml: 307; sed: 16
file content (39 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* probe.c -- used to test resampling */

#include "stdio.h"
#include "string.h"
#include "xlisp.h"
#include "sound.h"

static FILE* probefile = NULL;
static long line_num = 0;

void probe_init(int readflag)
{
    line_num = 0;
    probefile = fopen("probe.log", (readflag ? "r" : "w"));
}


double probe(char *s, double x)
{
    fprintf(probefile, "%s %g\n", s, x);
    return x;
}


double probe2(char *s, double x)
{
    char buf1[100], buf2[100];
    sprintf(buf1, "%s %g\n", s, x);
    fgets(buf2, 100, probefile);
    line_num++;
    if (strcmp(buf1, buf2)) {
        nyquist_printf("probe2: difference at line %ld: \n", line_num);
        nyquist_printf("correct: %s", buf2);
        nyquist_printf("actual:  %s", buf1);
        abort();
    }
    return x;
}