Skip to content

Commit

Permalink
Clean up CMakeLists and reformat long source-code lines
Browse files Browse the repository at this point in the history
  • Loading branch information
fluidnumerics-joe committed Nov 13, 2020
1 parent 8caa7e7 commit 8531de9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
21 changes: 0 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
# Default compiler gfortran, otherwise cmake Fortran package will set it to f95
# You can override the compiler with cmake -DFEQPARSE_COMPILER=
set(FEQPARSE_COMPILER "/usr/bin/gfortran" CACHE STRING "Fortran Compiler to build feqparse")
set(FEQPARSE_AR "/usr/bin/gcc-ar" CACHE STRING "Static archive command")
set(FEQPARSE_RANLIB "/usr/bin/gcc-ranlib" CACHE STRING "ranlib used to create Static archive")
set(FEQPARSE_COMPILER_FLAGS "-std=f2003 -ffree-form -ffree-line-length-none -cpp" CACHE STRING "Compiler flags to build feqparse")
set(FEQPARSE_INSTALL_DIR "/opt/feqparse" CACHE STRING "Install directory for feqparse")
message("-- FEQPARSE ------------- cmake START -------------------")
message("-- FEQPARSE_COMPILER: ${FEQPARSE_COMPILER}")
message("-- FEQPARSE_AR: ${FEQPARSE_AR}")
message("-- FEQPARSE_RANLIB: ${FEQPARSE_RANLIB}")
message("-- FEQPARSE_COMPILER_FLAGS: ${FEQPARSE_COMPILER_FLAGS}")
message("-- FEQPARSE_INSTALL_DIR: ${FEQPARSE_INSTALL_DIR}")
message("-- FEQPARSE ----------------------------------------------")

set(CMAKE_Fortran_COMPILER_INIT ${FEQPARSE_COMPILER})
set(CMAKE_VERBOSE_MAKEFILE ON)


PROJECT(feqparse Fortran C)
SET(CMAKE_BUILD_TYPE ${FEQPARSE_BUILD_TYPE})
SET(VERSION 0.0.0)
SET(CMAKE_AR ${FEQPARSE_AR})
SET(CMAKE_RANLIB ${FEQPARSE_RANLIB})
SET(CMAKE_INSTALL_PREFIX ${FEQPARSE_INSTALL_DIR})
message("-- CMAKE_INSTALL_PREFIX:${CMAKE_INSTALL_PREFIX}")

INCLUDE(FortranCInterface)
FortranCInterface_VERIFY()
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
set(CMAKE_Fortran_FLAGS "${FEQPARSE_COMPILER_FLAGS} ${CMAKE_Fortran_FLAGS}")
set(CMAKE_VERBOSE_MAKEFILE ON)
file(GLOB FEQPARSE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.F*")

Expand Down
12 changes: 8 additions & 4 deletions src/FEQParse.F90
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,15 @@ SUBROUTINE Tokenize( parser, tokenized, errorMsg )


IF( parser % inFix % tokens(1) % tokenType == Operator_Token )THEN
IF( TRIM( parser % inFix % tokens(1) % tokenString ) == "+" .OR. TRIM( parser % inFix % tokens(1) % tokenString ) == "-" ) THEN
IF( TRIM( parser % inFix % tokens(1) % tokenString ) == "+" .OR. &
TRIM( parser % inFix % tokens(1) % tokenString ) == "-" ) THEN
parser % inFix % tokens(1) % tokenType = Monadic_Token
END IF
END IF

DO i = 2, parser % inFix % top_index
IF( parser % inFix % tokens(i) % tokenType == Operator_Token .AND. parser % inFix % tokens(i-1) % tokenType == OpeningParentheses_Token ) THEN
IF( parser % inFix % tokens(i) % tokenType == Operator_Token .AND. &
parser % inFix % tokens(i-1) % tokenType == OpeningParentheses_Token ) THEN
parser % inFix % tokens(i) % tokenType = Monadic_Token
END IF
END DO
Expand Down Expand Up @@ -413,15 +415,17 @@ SUBROUTINE ConvertToPostFix( parser )

CALL operator_stack % push( parser % inFix % tokens(i) )

ELSEIF( parser % inFix % tokens(i) % tokenType == Operator_Token .OR. parser % inFix % tokens(i) % tokenType == Monadic_Token )THEN
ELSEIF( parser % inFix % tokens(i) % tokenType == Operator_Token &
.OR. parser % inFix % tokens(i) % tokenType == Monadic_Token )THEN


IF( .NOT. operator_stack % IsEmpty( ) )THEN

tok = operator_stack % TopToken( )

DO WHILE( TRIM(tok % tokenString) /= "(" .AND. &
Priority( TRIM(tok % tokenString) ) > Priority( TRIM(parser % inFix % tokens(i) % tokenString) ) )
Priority( TRIM(tok % tokenString) ) > &
Priority( TRIM(parser % inFix % tokens(i) % tokenString) ) )

CALL parser % postFix % push( tok )
CALL operator_stack % pop( tok )
Expand Down

0 comments on commit 8531de9

Please sign in to comment.