Skip to content

Commit

Permalink
Simplified write code for optional arguments in all templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Hovy committed Mar 6, 2019
1 parent bf5ef60 commit b0efd61
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 64 deletions.
24 changes: 8 additions & 16 deletions templates/BaseCompare/capture.aftersubroutine.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ SUBROUTINE ftg_${subroutine.name}_capture_input($commaList($args))
#end for

! OPTIONAL ARGUMENTS
#for $arg in $args.optionals
#if $arg.usedVariables
IF (PRESENT($arg.name)) THEN
#for $var in $arg.usedVariables
$ftgWrite($var)
#end for
END IF
#end if
#for $var in $args.optionals.usedVariables
IF (PRESENT($var.container(0))) THEN $mergeBegin('present')
$ftgWrite($var) $clearLine
END IF $mergeEnd('present')
#end for

! GLOBALS
Expand Down Expand Up @@ -90,14 +86,10 @@ SUBROUTINE ftg_${subroutine.name}_capture_output($commaList($args.allOut, $resul
#end for

! OPTIONAL ARGUMENTS
#for $arg in $args.allOut.optionals
#if $arg.usedVariables
IF (PRESENT($arg.name)) THEN $mergeBegin('present')
#for $var in $arg.usedVariables
$ftgWrite($var)
#end for
END IF $mergeEnd('present')
#end if
#for $var in $args.allOut.optionals.usedVariables
IF (PRESENT($var.container(0))) THEN $mergeBegin('present')
$ftgWrite($var) $clearLine
END IF $mergeEnd('present')
#end for

#if $subroutine.isFunction
Expand Down
24 changes: 8 additions & 16 deletions templates/IconStandalone/capture.aftersubroutine.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,10 @@ SUBROUTINE ftg_${subroutine.name}_capture_input($commaList($args))
#end for

! OPTIONAL ARGUMENTS
#for $arg in $args.optionals
#if $arg.usedVariables
IF (PRESENT($arg.name)) THEN $mergeBegin('present')
#for $var in $arg.usedVariables
$ftgWrite($var) $clearLine
#end for
END IF $mergeEnd('present')
#end if
#for $var in $args.optionals.usedVariables
IF (PRESENT($var.container(0))) THEN $mergeBegin('present')
$ftgWrite($var) $clearLine
END IF $mergeEnd('present')
#end for

! GLOBALS
Expand Down Expand Up @@ -132,14 +128,10 @@ SUBROUTINE ftg_${subroutine.name}_capture_output($commaList($args.allOut, $resul
#end for

! OPTIONAL ARGUMENTS
#for $arg in $args.allOut.optionals
#if $arg.usedVariables
IF (PRESENT($arg.name)) THEN $mergeBegin('present')
#for $var in $arg.usedVariables
$ftgWrite($var) $clearLine
#end for
END IF $mergeEnd('present')
#end if
#for $var in $args.allOut.optionals.usedVariables
IF (PRESENT($var.container(0))) THEN $mergeBegin('present')
$ftgWrite($var) $clearLine
END IF $mergeEnd('present')
#end for

#if $subroutine.isFunction
Expand Down
24 changes: 8 additions & 16 deletions templates/Standalone/capture.aftersubroutine.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,10 @@ SUBROUTINE ftg_${subroutine.name}_capture_input($commaList($args))
#end for

! OPTIONAL ARGUMENTS
#for $arg in $args.optionals
#if $arg.usedVariables
IF (PRESENT($arg.name)) THEN $mergeBegin('present')
#for $var in $arg.usedVariables
$ftgWrite($var) $clearLine
#end for
END IF $mergeEnd('present')
#end if
#for $var in $args.optionals.usedVariables
IF (PRESENT($var.container(0))) THEN $mergeBegin('present')
$ftgWrite($var) $clearLine
END IF $mergeEnd('present')
#end for

! GLOBALS
Expand Down Expand Up @@ -125,14 +121,10 @@ SUBROUTINE ftg_${subroutine.name}_capture_output($commaList($args.allOut, $resul
#end for

! OPTIONAL ARGUMENTS
#for $arg in $args.allOut.optionals
#if $arg.usedVariables
IF (PRESENT($arg.name)) THEN $mergeBegin('present')
#for $var in $arg.usedVariables
$ftgWrite($var) $clearLine
#end for
END IF $mergeEnd('present')
#end if
#for $var in $args.allOut.optionals.usedVariables
IF (PRESENT($var.container(0))) THEN $mergeBegin('present')
$ftgWrite($var) $clearLine
END IF $mergeEnd('present')
#end for

#if $subroutine.isFunction
Expand Down
24 changes: 8 additions & 16 deletions templates/StandaloneNoMPI/capture.aftersubroutine.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,10 @@ SUBROUTINE ftg_${subroutine.name}_capture_input($commaList($args))
#end for

! OPTIONAL ARGUMENTS
#for $arg in $args.optionals
#if $arg.usedVariables
IF (PRESENT($arg.name)) THEN $mergeBegin('present')
#for $var in $arg.usedVariables
$ftgWrite($var) $clearLine
#end for
END IF $mergeEnd('present')
#end if
#for $var in $args.optionals.usedVariables
IF (PRESENT($var.container(0))) THEN $mergeBegin('present')
$ftgWrite($var) $clearLine
END IF $mergeEnd('present')
#end for

! GLOBALS
Expand Down Expand Up @@ -117,14 +113,10 @@ SUBROUTINE ftg_${subroutine.name}_capture_output($commaList($args.allOut, $resul
#end for

! OPTIONAL ARGUMENTS
#for $arg in $args.allOut.optionals
#if $arg.usedVariables
IF (PRESENT($arg.name)) THEN $mergeBegin('present')
#for $var in $arg.usedVariables
$ftgWrite($var) $clearLine
#end for
END IF $mergeEnd('present')
#end if
#for $var in $args.allOut.optionals.usedVariables
IF (PRESENT($var.container(0))) THEN $mergeBegin('present')
$ftgWrite($var) $clearLine
END IF $mergeEnd('present')
#end for

#if $subroutine.isFunction
Expand Down

0 comments on commit b0efd61

Please sign in to comment.