From 2b82afe671ca09cc2bdd337f2d4d01fddafc38d5 Mon Sep 17 00:00:00 2001 From: sakamoti <62064838+sakamoti@users.noreply.github.com> Date: Sun, 6 Sep 2020 02:39:29 +0900 Subject: [PATCH 1/2] bugfix in the example 108 Error (missing line color) occured from gnuplot. I added appropriate color specifications. --- demo.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo.f90 b/demo.f90 index 8bef3bb..de830de 100644 --- a/demo.f90 +++ b/demo.f90 @@ -1474,7 +1474,7 @@ subroutine exmp108 call gp%options('unset tics') ! turn off axes values (tics) call gp%options('set view map') ! set viewpoint top down ! plot using linespec - call gp%surf(x,y,z,lspec='w lp ps 2 pt 6 lc ""') + call gp%surf(x,y,z,lspec='w lp ps 2 pt 6 lc "#99aa33') end subroutine exmp108 From 97dd16d5775d63197bf79ae2e18bcbfcaaa95b48 Mon Sep 17 00:00:00 2001 From: sakamoti <62064838+sakamoti@users.noreply.github.com> Date: Sun, 6 Sep 2020 02:57:26 +0900 Subject: [PATCH 2/2] (bug fix) kind parameter and character object Because the byte-order kind specifier description remained, I replace them with the module variable sp and dp. In addition, because there was a case to apply "len_trim" function for the unallocated character object, some compiler cause segmentation fault etc. Therefore, I append some "if statement" for checking allocation status to initialize them. --- ogpf.f90 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ogpf.f90 b/ogpf.f90 index 2aab17f..35b5eda 100644 --- a/ogpf.f90 +++ b/ogpf.f90 @@ -352,12 +352,13 @@ subroutine set_options(this,stropt) class(gpf):: this character(len=*), intent(in) :: stropt + if(.not.allocated(this%txtoptions))this%txtoptions='' if (len_trim(this%txtoptions) == 0 ) then this%txtoptions = '' ! initialize string end if if ( len_trim(stropt)>0 ) then this%txtoptions = this%txtoptions // splitstr(stropt) - end if + end if this%hasoptions=.true. @@ -550,6 +551,10 @@ subroutine set_label(this, lblname, lbltext, lblcolor, font_size, font_name, rot if (present(font_name)) then label%lblfontname = font_name + else + if(.not.allocated(label%lblfontname))then + label%lblfontname = '' + endif end if if (present(font_size)) then @@ -1598,6 +1603,7 @@ subroutine addscript(this,strcmd) class(gpf) :: this character(len=*), intent(in) :: strcmd + if (.not.allocated(this%txtscript)) this%txtscript='' if (len_trim(this%txtscript) == 0 ) then this%txtscript = '' ! initialize string end if @@ -2320,7 +2326,7 @@ function num2str_i4(number_in) ! num2str_int: converts integer number to string !.............................................................................. - integer(kind=4), intent(in) :: number_in + integer(kind=kind(1)), intent(in) :: number_in character(len=:), allocatable :: num2str_i4 ! local variable @@ -2336,7 +2342,7 @@ function num2str_r4(number_in, strfmt) ! strfmt is the optional format string !.............................................................................. - real(kind=4), intent(in) :: number_in + real(kind=sp), intent(in) :: number_in character(len=*), intent(in), optional :: strfmt character(len=:), allocatable :: num2str_r4 @@ -2361,7 +2367,7 @@ function num2str_r8(number_in, strfmt) ! strfmt is the optional format string !.............................................................................. - real(kind=8), intent(in) :: number_in + real(kind=dp), intent(in) :: number_in character(len=*), intent(in), optional :: strfmt character(len=:), allocatable :: num2str_r8