File: make_manpage.pl

package info (click to toggle)
openmpi 3.1.3-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 118,572 kB
  • sloc: ansic: 628,972; f90: 17,993; makefile: 13,761; sh: 7,051; java: 6,360; perl: 3,215; cpp: 2,225; python: 1,350; lex: 988; fortran: 52; tcl: 12
file content (82 lines) | stat: -rwxr-xr-x 2,310 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
79
80
81
82
#!/usr/bin/env perl
#
# Copyright (c) 2015      Research Organization for Information Science
#                         and Technology (RIST). All rights reserved.
# Copyright (c) 2015      Cisco Systems, Inc.  All rights reserved.
# $COPYRIGHT$
#
# Subroutine to generate a bunch of Fortran declarations and symbols
#

use strict;

use Getopt::Long;

my $package_name;
my $package_version;
my $ompi_date;
my $opal_date;
my $orte_date;
my $cxx = '1';
my $fortran = '1';
my $f08 = '1';
my $input;
my $output;
my $help_arg = 0;

&Getopt::Long::Configure("bundling");
my $ok = Getopt::Long::GetOptions("package-name=s" => \$package_name,
                                  "package-version=s" => \$package_version,
                                  "ompi-date=s" => \$ompi_date,
                                  "opal-date=s" => \$opal_date,
                                  "orte-date=s" => \$orte_date,
                                  "cxx!" => \$cxx,
                                  "fortran!" => \$fortran,
                                  "f08!" => \$f08,
                                  "input=s" => \$input,
                                  "output=s" => \$output);

if ($help_arg || !$ok ||
    !defined($input) ||
    !defined($output) ||
    !defined($package_name) ||
    !defined($package_version) ||
    !defined($ompi_date) ||
    !defined($opal_date) ||
    !defined($orte_date)) {
    print "Usage: $0 --package-name=<package name> --package-version=<package version> --ompi-date=<ompi date> --opal-date=<opal date> --orte-date=<orte date> --input=<input file> --output=<output file> [--nocxx] [ --nofortran] [--nof08]\n";
    exit(1 - $ok);
}

open(FILE, $input) ||
    die "Can't open $input";
my $file;
$file .= $_
    while(<FILE>);
close(FILE);

$file =~ s/#PACKAGE_NAME#/$package_name/g;
$file =~ s/#PACKAGE_VERSION#/$package_version/g;
$file =~ s/#OMPI_DATE#/$ompi_date/g;
$file =~ s/#OPAL_DATE#/$opal_date/g;
$file =~ s/#ORTE_DATE#/$orte_date/g;

if ($cxx == 0) {
    $file =~ s/\n\.SH C\+\+ Syntax.+?\n\.SH/\n\.SH/s;
}

if ($fortran == 0) {
    $file =~ s/\n\.SH Fortran Syntax.+?\n\.SH/\n\.SH/s;
}

if ($f08 == 0) {
    $file =~ s/\n\.SH Fortran 2008 Syntax.+?\n\.SH/\n\.SH/s;
}

open(FILE, ">$output") ||
    die "Can't open $output";
print FILE $file;
close(FILE);

exit(0);