Skip to content

Commit

Permalink
(header-bot) further bug fix with header replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljprice committed Jul 29, 2020
1 parent cfbf9e0 commit 102e4eb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
22 changes: 16 additions & 6 deletions scripts/header.pl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ sub get_descript {
# header ends when a line that is not a comment
# is encountered
#
if ( !m/\!.*/ ) { $inheader = 0 };
if ( !m/^\s*\!.*/ ) { $inheader = 0 };

if ($inheader && !m/\!\+/ && !m/\!-+/ && ($n == 1) ) {
$descript = "$descript$_";
Expand Down Expand Up @@ -256,12 +256,22 @@ sub get_descript_free {
sub get_module_descript_free {
my $header = shift;
my $descript = '';
# match everything between !+ and !+
if ($header =~ m/\!\+\s*\n(.*?\n)\!\+\s*/ ) {
# match everything between !+ and !+
$descript=$1;
} elsif ($header =~ m/^!\s*\n(.*?\n)^!(\s*?\n)!\s*\:References\:/sm ) {
# match everything starting with a blank comment line
# and ending with the :References: tag
$descript=$1;
$descript =~ s/!\s+(\w)/\! $1/; # single indentation in description text
} elsif ($header =~ m/^!\s*\n(.*?\n)^!(\s*?\n)!\s*[A-Z]+\:/sm ) {
# match everything starting with a blank comment line
# and ending with another tag in upper case e.g. REFERENCES:
$descript=$1;
$descript =~ s/!\s+(\w)/\! $1/; # single indentation in description text
} elsif ($header =~ m/^!\s*\n(.*?\n)^!(\s*?\n)!\s*\:[A-Z|a-z|\:]+\:/sm ) {
# match everything starting with a blank comment line
# and ending with another tag e.g. REFERENCES:
} elsif ($header =~ m/^!\s*\n(.*?\n)^!(\s*?\n)!\s*[A-Z|a-z|\:]+\:/sm ) {
# and ending with another tag :tag:, either upper or lower case
$descript=$1;
$descript =~ s/!\s+(\w)/\! $1/; # single indentation in description text
#print "GOT DESCRIPT=$descript\n";
Expand Down Expand Up @@ -380,7 +390,7 @@ sub get_extra {
for (split /^/, $header) {
my $line = $_;
# match everything NOT included in original header
if ( !m/!.*|^\s*module\s+\w.*$|\s*program\s+\w.*$/ ) { $inheader = 0; }
if ( !m/^\s*!.*|^\s*module\s+\w.*$|\s*program\s+\w.*$/ ) { $inheader = 0; }
if ($inheader==0) {
if ( m/!.*$|^\s*$/ ) { # only lines that are comments or whitespace
$notinheader = "$notinheader$_";
Expand Down Expand Up @@ -613,7 +623,7 @@ sub parsefile {
while ( <$fh> ) {
# end of header is when no longer a comment
# but includes the "module blah" or "program blah" statement
if ( !m/!.*|^\s*$|^\s*module\s+\w.*$|\s*program\s+\w.*$/ ) { $inheader = 0; }
if ( !m/^\s*!.*|^\s*$|^\s*module\s+\w.*$|\s*program\s+\w.*$/ ) { $inheader = 0; }
if ($inheader==0) {
print $_;
}
Expand Down
11 changes: 11 additions & 0 deletions src/utils/analysis_binarydisc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ module analysis
!
! Analysis routine for discs in binary systems by CJN
!
! Method:
! "primary(secondary)" implies tag=1(2) not anything to do with mass or disc hosting etc.
! Circumprimary disc: only particles inside the primary Roche-lobe & bound
! Circumsecondary disc: only particles inside the secondary Roche-lobe & bound
! Circumbinary disc: only particles at R > a (semi-major axis, not separation) & bound
!
! Creates: binary.dat for binary params
! circumprimary_*.dat for circumprimary disc params
! circumsecondary_*.dat for circumsecondary disc params
! circumbinary_*.dat for circumbinary disc params
!
! :References: None
!
! :Owner: Daniel Price
Expand Down

0 comments on commit 102e4eb

Please sign in to comment.