From 9394b9bdfb1a8146540190b28aa8f43c750de12c Mon Sep 17 00:00:00 2001 From: sgeard Date: Wed, 14 Jun 2023 20:42:02 +0100 Subject: [PATCH] Removed redundant subroutine --- GNUmakefile | 5 +++++ app/main.f90 | 19 ++++++------------- src/rpn_stack.f90 | 4 ---- src/rpn_stack_sm.f90 | 9 +-------- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 655296e..1fdef7d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -11,9 +11,14 @@ F_OPTS := -fpic -I $(BUILD_DIR) else F_OPTS := -fpic -module $(BUILD_DIR) + ifdef debug +ifeq ($(F),ifx) +F_OPTS += -g +else F_OPTS += -ggdb -debug-parameters used endif +endif endif diff --git a/app/main.f90 b/app/main.f90 index 1838ed5..0a67e80 100644 --- a/app/main.f90 +++ b/app/main.f90 @@ -26,13 +26,11 @@ program hp15c integer :: n_seq = 0 logical :: veMode = .false. - logical :: lang_en = .true. logical :: tmp_cmode logical :: ok logical :: have_expression integer :: stat character(len=100) :: msg - character(5) :: lang type(rpn_t) :: mem(0:9) = rpn_t() @@ -53,16 +51,9 @@ program hp15c call constants%set('two_pi',2*pi) call constants%set('pi_over_2',pi/2) - ! Try to read the LANG environment variable - call get_environment_variable('LANG',lang,status=stat) - lang_en = stat /= 0 - if (.not. lang_en) then - lang_en = merge(.true.,.false.,lang(1:3) == 'en_') - end if - lang = merge('POINT','COMMA',lang_en) - - call init(lang) - + ! Decimal places + call set_places(dec_places) + ! Interrogate argument list argc = command_argument_count() have_expression = .false. @@ -106,7 +97,6 @@ program hp15c if (.not. ok) stop end do - if (.not. have_expression) then call stack%print(veMode) end if @@ -624,6 +614,7 @@ contains case default ! Process constants first + print *,'apply_command: default' block integer :: lc,split_idx,end_idx character(len=:), allocatable :: re_comp, im_comp @@ -661,8 +652,10 @@ contains else if (constants%contains(command)) then x = constants%get_value(command) + print *,command//' is constant = ',x else if (stats%contains(command)) then x = stats%get_value(command) + print *,command//' is stats' else read(command,*,err=901,end=901) x end if diff --git a/src/rpn_stack.f90 b/src/rpn_stack.f90 index 88015bf..2e73cc8 100644 --- a/src/rpn_stack.f90 +++ b/src/rpn_stack.f90 @@ -417,10 +417,6 @@ module rpn_stack real(real64), intent(in) :: x real(real64) ::r end function round - - module subroutine init(lang) - character(5), intent(in), optional :: lang - end subroutine init module subroutine set_places(n) integer, intent(in) :: n diff --git a/src/rpn_stack_sm.f90 b/src/rpn_stack_sm.f90 index 68c9583..8d09353 100644 --- a/src/rpn_stack_sm.f90 +++ b/src/rpn_stack_sm.f90 @@ -27,7 +27,7 @@ contains write(output_unit,'(dt)') stk%sdata(i) end do else - write(6,fmt='(dt)') stk%sdata(1) + write(output_unit,fmt='(dt)') stk%sdata(1) end if end subroutine print_stackt @@ -155,7 +155,6 @@ contains character(*), intent(inout) :: iomsg complex(8) :: z character(len=:), allocatable :: str_re, str_im - z = se%zdata if (complex_mode) then call to_string(z%re,str_re) @@ -736,12 +735,6 @@ contains r = x end if end function round - - module subroutine init(lang) - character(5), intent(in), optional :: lang - if (present(lang)) decimal = lang - call set_places(dec_places) - end subroutine init module subroutine set_places(n) integer, intent(in) :: n