File: replacePaths_f77.awk

package info (click to toggle)
opari2 1.0.7%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,780 kB
  • ctags: 1,121
  • sloc: sh: 11,496; cpp: 5,961; ansic: 3,727; f90: 450; fortran: 307; makefile: 218; awk: 164
file content (86 lines) | stat: -rwxr-xr-x 3,031 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
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
# This file is part of the Score-P software (http://www.score-p.org)
# 
# Copyright (c) 2009-2011,
#    *    RWTH Aachen University, Germany
#    *    Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
#    *    Technische Universitaet Dresden, Germany
#    *    University of Oregon, Eugene, USA
#    *    Forschungszentrum Juelich GmbH, Germany
#    *    German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
#    *    Technische Universitaet Muenchen, Germany
#  
# See the COPYING file in the package base directory for details.

{
    if(match($0,"sscl=")){
        line = "    "    
        for(i = 1; i <= NF; i++){
            source = $i
            if(match($i,"\"//")){
                # opari2 splits the ctc-string into multiple lines, for
                # comparison to reference data we put this into one line
                while(match(source, "\"//")){
                    # this is nasty, by getting a new line, we have to reset
                    # the record counter i to 1 so we don't miss the closing
                    # bracket at the end of the last line
                    getline
                    i = 1
                    sub("     \"", "", $1)
                    source = source $1
                    sub("\"//&\"", "", source)
                }
                # remove full path
                gsub("escl=([^/]*/)*","escl=",source)
                gsub("sscl=([^/]*/)*","sscl=",source)
                # remove old length
                sub("\"[0-9a-z]*","\"", source)
                # insert new length
                sub("\"", "\""length(source)-2, source)
                line = line " " source
            }
            else{
                line = line " " $i
            }
        }

        # now for fortran77 we split the line again
        while(length(line) > 66){
            subline = substr(line, 1, 66) 
            print subline"\"//"
            line = "     &\"" substr(line, 67)
        }
        print line
#	splitindex = match(line,"Type=")+5
#	print "splitindex=" splitindex "for " line
#	lineRepl = substr(line, 0, splintindex-1) "\"//\n     &\"" substr(line, splitindex)
#	line = lineRepl
#	print lineRepl
    }
    else if(match($0,"POMP2_Init_reg")){
        #remove the timestamp based region identifier
        gsub("Init_reg_[0-9a-z_]+","Init_reg_000",$0)
        print $0
    }
    else if(match($0,"#line")){
        #remove the path from the line numbering
        gsub("/([^/]*/)*","",$0)
        print $0
    }
#    else if(match($0,"get_max_threads")){
        #remove timestamp based function specifier
#        gsub("pomp_get_max_threads[0-9a-z_]*", "pomp_get_max_threads000", $0)
#        print $0
#    }
    else if(match($0,"/cb")){
        #remove timestamp based common block identifier
        gsub("cb[0-9a-z_]*", "cb000", $0)
        print $0
    }
    else if(match($0,"CHARACTER*")){
        gsub("CHARACTER\\*[0-9a-z]*", "CHARACTER*999", $0)
        print $0
    }
    else{
        print $0
    }
}