File: tinyscript.sh

package info (click to toggle)
scip 10.0.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,156 kB
  • sloc: ansic: 716,600; cpp: 41,095; awk: 9,195; sh: 4,918; makefile: 4,044; python: 2,076; perl: 731; xml: 660; java: 314; php: 24; lisp: 15
file content (107 lines) | stat: -rwxr-xr-x 2,591 bytes parent folder | download
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#! /bin/bash

i=0

mkdir -p newfiles/scip
rm newfiles/scip/*

function getFileLen {
    filename=$1
    len=`wc -l $filename | awk '{print $1}'`
    echo $len
}

while read line
do
    i=$((i + 1))
    echo $i $line
    doxygroup=`echo $line | awk '{print $1}'`
    headername=`echo $line | awk '{print $2}'`
    echo $doxygroup
    export headername
    echo   "/${doxygroup}/,/@}/p"
    export header=newfiles/scip/scip_${headername}.h

    if [ ! -f $header ]
    then
        export doxygengroup=PUBLICCOREAPI
        export doxygenbrief="public methods for $headername"
        export guard="__SCIP_SCIP_`echo $headername | tr [:lower:] [:upper:]`_H__"

        envsubst < header_head_template.h > $header
    else
        #
        # delete the footer from the previous round with an inline sed
        #
        len=`getFileLen $header`
        footlen=`getFileLen header_foot.h`
        startline=`expr $len - $footlen + 2`

        sed -i "${startline},$$d" $header
    fi

    sed -n "/${doxygroup}/,/@}/p" ../../src/scip/scip.h >> $header
    cat header_foot.h >> $header
done < groups_names.list

#
# use the write gaps functionality to write the gap file
#
./parse_functions.py ../../src/scip/scip.{c,h} --write_gaps

for i in newfiles/scip/*.h
do
    header=$i
    module=newfiles/scip/$(basename $i .h).c

    echo $module

    ./parse_functions.py ../../src/scip/scip.c $header > tmp.list

    modulebasename=$(basename $module)
    export modulebasename
    envsubst < preamble.c > $module

    cat all_includes.c >> $module

    if [ $header = newfiles/scip/scip_numerics.h ]
    then
        echo >> $module
        sed -n '/In debug mode, the following methods are implemented as function calls to ensure/,/undef SCIPgetHugeValue/p' ../../src/scip/scip.c >> $module
        echo >> $module
    fi

    if [ $header = newfiles/scip/scip_expr.h ]
    then
        cat >>$module <<EOL
/** translate from one value of infinity to another
 *
 *  if val is >= infty1, then give infty2, else give val
 */
#define infty2infty(infty1, infty2, val) (val >= infty1 ? infty2 : val)

EOL
    fi

    if [ $header = newfiles/scip/scip_nlp.h ]
    then
        sed -n '/method to call, when the priority of an NLPI was changed/,/^\}/p' ../../src/scip/scip.c >> $module
    fi

    sed -n -f tmp.list ../../src/scip/scip.c >> $module

    if [ $header = newfiles/scip/scip_expr.h ]
    then
        echo >> $module
        echo '#undef infty2infty' >> $module
    fi
done

rm newfiles/scip/scip_bandit.c

./organizeincludes.sh

#
# replace doxygen brief descriptions
#
./descriptions.sh