File: examples

package info (click to toggle)
c++-annotations 11.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 11,244 kB
  • sloc: cpp: 21,698; makefile: 1,505; ansic: 165; sh: 121; perl: 90
file content (78 lines) | stat: -rw-r--r-- 1,803 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
void tryCompile(string source)
{
    string obj;

    obj = change_ext(source, "o");

    if (obj newer source)
        return;

    if (strfind("koenig4.cc"
                "personconstr.cc"
                "stringsmove.cc"
                "binarystring.cc"
                "stringconversionerror.cc"
                "binaryambigu.cc"
                "binary1.cc"
                "virtconsorg.cc"
                "refwrap.cc"
                "ambiguous2.cc"
                "ambiguous.cc"
                "buffer.cc"
                "perfect.cc"
                "basename1.cc"
                , source) != -1)
        return;

    system("g++ --std=c++0x -c " + source);
}

void compile(string dir)
{
    list sources;
    int idx;

    chdir(dir);
    printf(dir, "\n");

    sources = makelist("*.cc");

    for (idx = listlen(sources); idx--; )
        tryCompile(sources[idx]);
}
    

void examples()
{
    list dirs;
    int idx;
    string cwd;

    cwd = chdir("yo");

    dirs = strtok(
            "intro/examples:first/examples:namespaces/examples:"
            "string/examples:iostreams/examples:iostreams/cc:"
            "classes/examples:memory/examples:exceptions/examples:"
            "overloading/examples:containers/examples:"
            "containers/queue:containers/set:inheritance/examples:"
            "polymorphism/examples:pointermembers/examples:nested/examples:"
            "stl/examples:generic/examples:functiontemplates/examples:"
            "classtemplates/examples:advancedtemplates/examples:"
            "concrete/examples:concrete/examples/monitor"
            , 
            ":");

    for (idx = listlen(dirs); idx--; )
    {
        compile(dirs[idx]);
        chdir(cwd);
    }

    system(P_NOCHECK, "find ./ -type f -name *.o -delete");
    exit(0);
}