Skip to content

Commit

Permalink
Merge remote-tracking branch 'aradi/fyppfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
bhourahine committed Jan 16, 2020
2 parents 977b5a8 + 7e128bb commit aa3b8ad
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 132 deletions.
2 changes: 1 addition & 1 deletion external/fypp/LICENSE → external/fypp/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016-2017 Bálint Aradi, Universität Bremen
Copyright (c) 2016-2020 Bálint Aradi, Universität Bremen

All rights reserved.

Expand Down
36 changes: 18 additions & 18 deletions external/fypp/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ Main features

* Macro definitions and macro calls::

#:def assertTrue(cond)
#:if DEBUG > 0
if (.not. ${cond}$) then
print *, "Assert failed in file ${_FILE_}$, line ${_LINE_}$"
error stop
end if
#:endif
#:enddef assertTrue
#:def ASSERT(cond)
#:if DEBUG > 0
if (.not. ${cond}$) then
print *, "Assert failed in file ${_FILE_}$, line ${_LINE_}$"
error stop
end if
#:endif
#:enddef ASSERT

! Invoked via direct call (argument needs no quotation)
@:assertTrue(size(myArray) > 0)
@:ASSERT(size(myArray) > 0)

! Invoked as Python expression (argument needs quotation)
$:assertTrue('size(myArray) > 0')
$:ASSERT('size(myArray) > 0')

* Conditional output::

Expand Down Expand Up @@ -93,30 +93,30 @@ Main features
* Passing (unquoted) multiline string arguments to callables::

#! Callable needs only string argument
#:def debug_code(code)
#:def DEBUG_CODE(code)
#:if DEBUG > 0
$:code
#:endif
#:enddef debug_code
#:enddef DEBUG_CODE

#! Pass code block as first positional argument
#:call debug_code
#:block DEBUG_CODE
if (size(array) > 100) then
print *, "DEBUG: spuriously large array"
end if
#:endcall debug_code
#:endblock DEBUG_CODE

#! Callable needs also non-string argument types
#:def repeat_code(code, repeat)
#:def REPEAT_CODE(code, repeat)
#:for ind in range(repeat)
$:code
#:endfor
#:enddef repeat_code
#:enddef REPEAT_CODE

#! Pass code block as positional argument and 3 as keyword argument "repeat"
#:call repeat_code(repeat=3)
#:block REPEAT_CODE(repeat=3)
this will be repeated 3 times
#:endcall repeat_code
#:endblock REPEAT_CODE

* Preprocessor comments::

Expand Down
Loading

0 comments on commit aa3b8ad

Please sign in to comment.