Date:2012-12-09 20:56:32 (6 years 9 months ago)
Author:Werner Almesberger
Commit:a11670bb7bb6e506db72463fea6738100b22c9a7
Message:tornado/fw/sim/alg.c: accept data from standard input; fix "process"

Files: tornado/fw/sim/alg.c (2 diffs)

Change Details

tornado/fw/sim/alg.c
4747
4848static void process(unsigned v)
4949{
50    uint16_t e = MID << E_SHIFT;
51    uint32_t m = MID << M_SHIFT;
50    static uint16_t e = MID << E_SHIFT;
51    static uint32_t m = MID << M_SHIFT;
52    static bool up = 0;
5253    int d;
53    bool up = 0;
5454
5555    e = v+(e-(e >> E_SHIFT));
5656    m = v+(m-(m >> M_SHIFT));
...... 
7979    double t;
8080    char *end;
8181    int i;
82
83    if (argc != 2)
84        usage(*argv);
85    t = strtod(argv[1], &end);
86    if (*end)
82    unsigned v;
83
84    switch (argc) {
85    case 1:
86        while (scanf("%u", &v) == 1)
87            process(v);
88        break;
89    case 2:
90        t = strtod(argv[1], &end);
91        if (*end)
92            usage(*argv);
93        for (i = 0; i != t*S; i++) {
94            v = sample((double) i/S);
95            process(v);
96        }
97        break;
98    default:
8799        usage(*argv);
88    for (i = 0; i != t*S; i++) {
89        unsigned v = sample((double) i/S);
90
91        process(v);
92100    }
101
93102    return 0;
94103}

Archive Download the corresponding diff file

Branches:
master
tornado-v1



interactive