File: loadbc.cc

package info (click to toggle)
simrisc 16.06.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,568 kB
  • sloc: cpp: 6,889; fortran: 669; makefile: 112; ansic: 112; sh: 107
file content (40 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (2)
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
40
#define XERR
#include "survival.ih"

    // load the BC TNM category boundaries
void Survival::loadBC()
{
    auto lines = Parser::one({ "bc:" });

    LineInfo const *lineInfo = lines.get();

    istringstream in{ lineInfo->tail };

    char sep;
    uint16_t value;

    while (in >> sep)
    {
        if (sep == '*')
            value = Globals::uint16_max;
        else
        {
            in.unget();
            in >> value;
        }
        d_bc.push_back(value);
    }

    bool err = false;
    for (size_t idx = 1, end = d_bc.size(); idx < end; ++idx)
    {
        if (d_bc[idx - 1] >= d_bc[idx])
        {
            err = true;
            break;
        }
    }

    if (err or d_bc.back() != Globals::uint16_max)
        Err::msg(Err::NOT_CONSECUTIVE) << lineInfo->txt << endl;
}