Skip to content

Commit

Permalink
#32: fix licenses and add license scripts from vt
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Aug 9, 2024
1 parent e6aa7c6 commit 58e03bc
Show file tree
Hide file tree
Showing 45 changed files with 249 additions and 69 deletions.
81 changes: 81 additions & 0 deletions scripts/add-license-perl.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env perl

use File::Find::Rule;

use strict;
use warnings;

my ($path, $template, $extension) = ($ARGV[0], "license-template", ["*.h", "*.cc"]);

$template = $ARGV[1] if (@ARGV > 1);
$extension = $ARGV[2] if (@ARGV > 2);

print "Running: $path $template $extension\n";

my @files = File::Find::Rule->file()->name($extension)->in($path);

sub make_header {
my ($file, $out) = @_;
my @name2= split /\//, $file;
my $name = $name2[@name2-1];
my $lenname = length($name);
my $lenright = int((80 - 2 - $lenname)/2);
open TEMP, "<$template" or die "Can't access template\n";
for (<TEMP>) {
if (/file-name/) {
print $out "//" . (" " x $lenright) . $name . "\n";
} else {
print $out "$_";
}
}
close TEMP;
}

for my $file (@files) {

my $temp = `mktemp`;
my $out;
open $out, ">$temp" or die "Can't access $temp\n";

print "processing file: $file, $temp\n";

open DESC, "<$file" or die "Can't access $file\n";
my $in_header = 0;
my $output_header = 0;
for (<DESC>) {
if (/\/\/\@HEADER/) {
$in_header = !$in_header;
next;
}
if (!$in_header) {
print $out "$_";
} else {
if (!$output_header) {
&make_header($file, $out);
$output_header = 1;
}
}
}
close DESC;


if (!$output_header) {
close $out;
$temp = `mktemp`;
open $out, ">$temp" or die "Can't access $temp\n";
open DESC, "<$file" or die "Can't access $file\n";
print $out "/*\n";
&make_header($file, $out);
print $out "*/\n";
for (<DESC>) {
print $out "$_";
}
close DESC;
}

close $out;
chomp $temp;

print `mv $temp $file`;
#print "EXECUTE: mv $temp $file\n";
}
17 changes: 17 additions & 0 deletions scripts/check_license.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

path_to_vttv=${1}
cd "$path_to_vttv" || exit 1

for sub_dir in "src" "tests/unit" "examples"
do
"$path_to_vttv/scripts/add-license-perl.pl" "$path_to_vttv/$sub_dir" "$path_to_vttv/scripts/license-template"
done

result=$(git diff --name-only)

if [ -n "$result" ]; then
echo -e "Following files have incorrect license!\n"
echo "$result"
exit 1
fi
40 changes: 40 additions & 0 deletions scripts/license-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//@HEADER
// *****************************************************************************
//
// <file-name>
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact [email protected]
//
// *****************************************************************************
//@HEADER
4 changes: 2 additions & 2 deletions src/vt-tv/api/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// info.h
// info.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
42 changes: 42 additions & 0 deletions src/vt-tv/api/object_communicator.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
/*
//@HEADER
// *****************************************************************************
//
// object_communicator.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact [email protected]
//
// *****************************************************************************
//@HEADER
*/
#if !defined INCLUDED_VT_TV_API_OBJECT_COMMUNICATOR_H
#define INCLUDED_VT_TV_API_OBJECT_COMMUNICATOR_H

Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/api/object_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// object_info.h
// object_info.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/api/object_work.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// object_work.h
// object_work.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/api/phase_work.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// phase_work.h
// phase_work.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/api/rank.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// rank.h
// rank.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/api/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// types.h
// types.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/render/render.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// render.cc
// render.cc
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/render/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// render.h
// render.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/compressor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// compressor.cc
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// compressor.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/compressor.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// compressor.impl.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/decompression_input_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// decompression_input_container.cc
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/decompression_input_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// decompression_input_container.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/decompression_input_container.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// decompression_input_container.impl.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/decompressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// decompressor.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/decompressor.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// decompressor.impl.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/decompressor_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// decompressor_base.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
2 changes: 1 addition & 1 deletion src/vt-tv/utility/input_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// input_iterator.h
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/utility/json_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//@HEADER
// *****************************************************************************
//
// json_generator.cc
// json_generator.cc
// DARMA/vt-tv => Virtual Transport -- Task Visualizer
//
// Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
// Copyright 2019-2024 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
Expand Down
Loading

0 comments on commit 58e03bc

Please sign in to comment.