dc_trace Module Reference

Data Types

interface  datadump
 
interface  debug
 

Functions/Subroutines

integer function, public sublevel ()
 
subroutine, public dbg_scratch (on)
 
subroutine, public setdebug (debug)
 
subroutine dctracedebug (dbg_mode)
 
subroutine initialize
 
subroutine, public beginsub (name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
 
subroutine, public endsub (name, fmt, i, r, d, L, n, c1, c2, c3, ca)
 
subroutine, public dbgmessage (fmt, i, r, d, L, n, c1, c2, c3, ca)
 
subroutine datad1dump (header, d, strlen, multi)
 
subroutine datad2dump (header, d, strlen, multi)
 
subroutine datad3dump (header, d, strlen, multi)
 
subroutine append (unit, ucur, val, stat, strlen)
 

Variables

logical, save lfirst = .true.
 
integer, save, public dbg = -1
 
integer, save level = 0
 
integer, parameter trace_stack_size = 128
 
character(token), dimension(trace_stack_size), save table
 
character(string), dimension(:), allocatable, save called_subname
 
character(string), dimension(:), allocatable, save called_subname_tmp
 
character(1), parameter head = '#'
 
character(2), parameter indent = '| '
 
character(2), parameter meshead = '|-'
 

Function/Subroutine Documentation

◆ append()

subroutine dc_trace::append ( character(*), intent(inout)  unit,
integer, intent(inout)  ucur,
character(*), intent(in)  val,
integer, intent(out)  stat,
integer, intent(in), optional  strlen 
)

Definition at line 722 of file dc_trace.f90.

Referenced by datad1dump().

722  !
723  ! DataD1Dump の内部関数。
724  ! unit に val を付加。その際、unit がその最大文字列長を越えた場合
725  ! には stat = 2 を返す。
726  !
727  character(*), intent(inout):: unit ! 最終的に返される文字列
728  integer, intent(inout):: ucur ! unit の文字数
729  character(*), intent(in) :: val ! unit に付加される文字列
730  integer, intent(out) :: stat ! ステータス
731  integer, intent(in), &
732  & optional :: strlen ! 文字数の手動指定
733  integer :: wrsz ! val の文字列
734  continue
735  ! unit の最大長を越えた場合には stat = 2 を返す。
736  if (present(strlen)) then
737  if (ucur >= strlen) then
738  stat = 2
739  return
740  endif
741  else
742  if (ucur >= len(unit)) then
743  stat = 2
744  return
745  endif
746  endif
747  ! 正常時の処理。
748  ! unit の長さを越えた場合も考慮して unit に val を付加する。
749  wrsz = min(len(val), len(unit) - ucur)
750  unit(1+ucur: wrsz+ucur) = val(1: wrsz)
751  ucur = ucur + wrsz
752  stat = 0
753  if (wrsz < len(val)) stat = 1
Here is the caller graph for this function:

◆ beginsub()

subroutine, public dc_trace::beginsub ( character(*), intent(in)  name,
character(*), intent(in), optional  fmt,
integer, dimension(:), intent(in), optional  i,
real, dimension(:), intent(in), optional  r,
real(dp), dimension(:), intent(in), optional  d,
logical, dimension(:), intent(in), optional  L,
integer, dimension(:), intent(in), optional  n,
character(*), intent(in), optional  c1,
character(*), intent(in), optional  c2,
character(*), intent(in), optional  c3,
character(*), dimension(:), intent(in), optional  ca,
character(*), intent(in), optional  version 
)

Definition at line 351 of file dc_trace.f90.

References called_subname, called_subname_tmp, dbg, dc_types::dp, head, indent, initialize(), level, lfirst, dc_types::string, and table.

Referenced by adjust_slice(), gtool_history_internal::append_attrs(), gtool_history_internal::copy_attrs(), dccalconvertbyunit1(), dccalconvertbyunit2(), dccalconverttoday1(), dccalconverttoday2(), dccalconverttohour1(), dccalconverttohour2(), dccalconverttomin1(), dccalconverttomin2(), dccalconverttosec1(), dccalconverttosec2(), dccalcreate1(), dccalcreate2(), dccaldatecreate1(), dccaldatecreate2(), dccaldatecurrent1(), dccaldatedifference1(), dccaldateevalid1(), dccaldateevalid2(), dccaldateevalym2ym1(), dccaldateevalym2ym2(), dccaldateevalymdhms1(), dccaldateevalymdhms2(), dccaldateinquire1(), dccaldateinquire2(), dccaldateparsestr1(), dccaldefault1(), dccalinquire1(), dccalparseunit1(), dc_clock::dcclockclose0(), dc_clock::dcclockcreate0(), dc_clock::dcclockgetd(), dc_clock::dcclockgetr(), dc_clock::dcclockpredict0(), dc_clock::dcclockputline0(), dc_clock::dcclockresult0(), dc_clock::dcclocksetname0(), dc_clock::dcclockstart0(), dc_clock::dcclockstop0(), dcdatetimecreate1(), dcdatetimeeval1(), dcdatetimeputline(), dcdatetimesetcaltype(), dcdatetimesetsecofday(), dcdatetimesetzone(), dcdifftimecreate1(), dcdifftimecreate2d(), dcdifftimeeval1(), dcdifftimeputline(), dc_scaledsec::dcscaledseccreated(), dc_scaledsec::dcscaledsecputline(), dc_iounit::fileopen(), gdncattrgetchar(), gdncfileclose(), gdncfiledefinemode(), gdncfileinquirename(), gdncfileopen(), gdncfilereopen(), gdncsearchdim(), gdncvarcreate(), gdncvarcreated(), gdncvarinquire(), gdncvaropen(), gdncvarsearchinit(), gdncvarsearchnext(), getmatch(), gtvaradddim(), gtvarclose(), gtvarcopyattr(), gtvarcopyattrall(), gtvarcopydim(), gtvarcopyvalue(), gtvarcreate(), gtvarcreatecopyc(), gtvarcreated(), gtvardeldim(), gtvarexchdim(), gtvargetattrcc(), gtvarinquire(), gtvarinquire2(), gtvarinquirea(), gtvarinquired(), gtvarlimit(), gtvarlimit_iiii(), gtvaropen(), gtvaropenbydimord(), gtvarputattrchar(), gtvarputline(), gtvarsearchinit(), gtvarsearchnext(), gtvarslice(), gtvarslicec(), gtvarslicenext(), gtvarxformbinary(), historyaddattrchar0(), historyaddattrdouble0(), historyaddattrdouble1(), historyaddattrint0(), historyaddattrint1(), historyaddattrlogical0(), historyaddattrreal0(), historyaddattrreal1(), historyaddvariable1(), historyaddvariable2(), historyautoaddattrchar0(), historyautoaddattrdouble0(), historyautoaddattrdouble1(), historyautoaddattrint0(), historyautoaddattrint1(), historyautoaddattrlogical0(), historyautoaddattrreal0(), historyautoaddattrreal1(), historyautoaddvariable1(), historyautoaddvariable2(), historyautoaddweightdouble(), historyautoaddweightint(), historyautoaddweightreal(), historyautoallvarfix(), historyautoclose1(), historyautocreate1(), historyautocreate2(), historyautocreate3(), historyautoputaxisdouble(), historyautoputaxisint(), historyautoputaxismpidouble(), historyautoputaxismpiint(), historyautoputaxismpireal(), historyautoputaxisreal(), historyautoputdouble0(), historyautoputdouble1(), historyautoputdouble2(), historyautoputdouble3(), historyautoputdouble4(), historyautoputdouble5(), historyautoputdouble6(), historyautoputdouble7(), historyautoputint0(), historyautoputint1(), historyautoputint2(), historyautoputint3(), historyautoputint4(), historyautoputint5(), historyautoputint6(), historyautoputint7(), historyautoputreal0(), historyautoputreal1(), historyautoputreal2(), historyautoputreal3(), historyautoputreal4(), historyautoputreal5(), historyautoputreal6(), historyautoputreal7(), historyaxisaddattr2char0(), historyaxisaddattr2double0(), historyaxisaddattr2double1(), historyaxisaddattr2int0(), historyaxisaddattr2int1(), historyaxisaddattr2logical0(), historyaxisaddattr2real0(), historyaxisaddattr2real1(), historyaxisaddattrchar0(), historyaxisaddattrdouble0(), historyaxisaddattrdouble1(), historyaxisaddattrint0(), historyaxisaddattrint1(), historyaxisaddattrlogical0(), historyaxisaddattrreal0(), historyaxisaddattrreal1(), historyaxisclear(), historyaxiscopy1(), historyaxiscopy2(), historyaxiscreate1(), historyaxiscreate2(), historyaxisinquire1(), historyaxisinquire2(), historyclose(), historycopy1(), historycopy2(), historycopyvariable1(), historycreate1(), historycreate2(), historycreate3(), historygettattrchar0(), historygettattrdouble0(), historygettattrdouble1(), historygettattrint0(), historygettattrint1(), historygettattrreal0(), historygettattrreal1(), historyinquire1(), historyinquire2(), historyinquire3(), historyinquire4(), historyputaxismpidouble(), historyputaxismpiint(), historyputaxismpireal(), historyputchar0(), historyputcharex(), historyputdouble0(), historyputdouble1(), historyputdouble2(), historyputdouble3(), historyputdouble4(), historyputdouble5(), historyputdouble6(), historyputdouble7(), historyputdoubleex(), historyputint0(), historyputint1(), historyputint2(), historyputint3(), historyputint4(), historyputint5(), historyputint6(), historyputint7(), historyputintex(), historyputline(), historyputreal0(), historyputreal1(), historyputreal2(), historyputreal3(), historyputreal4(), historyputreal5(), historyputreal6(), historyputreal7(), historyputrealex(), historysettime(), historyvarinfoaddattr2char0(), historyvarinfoaddattr2double0(), historyvarinfoaddattr2double1(), historyvarinfoaddattr2int0(), historyvarinfoaddattr2int1(), historyvarinfoaddattr2logical0(), historyvarinfoaddattr2real0(), historyvarinfoaddattr2real1(), historyvarinfoaddattrchar0(), historyvarinfoaddattrdouble0(), historyvarinfoaddattrdouble1(), historyvarinfoaddattrint0(), historyvarinfoaddattrint1(), historyvarinfoaddattrlogical0(), historyvarinfoaddattrreal0(), historyvarinfoaddattrreal1(), historyvarinfoclear0(), historyvarinfocopy1(), historyvarinfocopy2(), historyvarinfocreate1(), historyvarinfocreate2(), historyvarinfoinquire1(), historyvarinfoinquire2(), gtool_historyauto_internal::hstfilecreate(), hstnmlinfoadd(), hstnmlinfoallnamevalid(), hstnmlinfoallvarinicheck(), hstnmlinfoassocgthist(), hstnmlinfoclose(), hstnmlinfocreate(), hstnmlinfodelete(), hstnmlinfoenddefine(), hstnmlinfogetnames(), hstnmlinfoinquire(), gtool_history_nmlinfo_internal::hstnmlinfolistlast(), gtool_history_nmlinfo_internal::hstnmlinfolistnext(), gtool_history_nmlinfo_internal::hstnmlinfolistsearch(), hstnmlinfooutputstepdisable(), hstnmlinfoputline(), hstnmlinforedefine(), hstnmlinforesetdefault(), hstnmlinfosetvalidname(), gtool_historyauto_internal::hstvarsoutputcheck(), gtool_history_internal::lookup_dimension(), lookup_growable_url(), gtool_history_internal::lookup_var_or_dim(), gtool_history_internal::lookup_variable(), gtool_history_internal::lookup_variable_ord(), lookupequivalent(), map_finished(), timegoahead(), dc_url::url_resolve_c(), and value_to_index().

351  !
352  !== 副プログラム開始のメッセージ出力
353  !
354  ! 文字型変数 *name* に与えた副プログラム名を以下のように出力します.
355  !
356  ! # call name
357  !
358  ! 複数回呼ぶ事で上記 (dc_trace の Overview 参照)
359  ! のようにメッセージが出力されます.
360  ! 必ず BeginSub と同様な数だけ EndSub を呼ぶようにしてください.
361  !
362  ! また, 文字型変数 *fmt* およびそれ以降の引数を与える事で,
363  ! 以下のように付加メッセージも出力可能です. *fmt*
364  ! とそれ以降の引数に関する書式は dc_string#CPrintf
365  ! の説明を参照して下さい.
366  !
367  ! # call name : fmt
368  !
369  ! 利用例に関しては dc_trace の Usage および Example を参照してください.
370  !
371  ! *version* には, 副プログラムのバージョンナンバーを与えます.
372  ! *version* に与えられた文字列は, ある副プログラム
373  ! が複数回呼び出されたうち, 初回に呼び出された時のみ表示されます.
374  !
375  !--
376  !== 開発者向け解説
377  !
378  ! このサブルーチンにより, このモジュール内で内部的に保持される
379  ! 整数型変数 level の値が 1 増えます。
380  !
381  !++
382  use dc_types, only: string, dp
383  use dc_string, only: cprintf, strinclude
384  character(*), intent(in) :: name
385  character(*), intent(in), optional:: fmt
386  integer, intent(in), optional:: i(:), n(:)
387  real, intent(in), optional:: r(:)
388  real(DP), intent(in), optional:: d(:)
389  logical, intent(in), optional:: l(:)
390  character(*), intent(in), optional:: c1, c2, c3
391  character(*), intent(in), optional:: ca(:)
392  character(*), intent(in), optional:: version
393  character(STRING) :: cbuf
394  character(STRING) :: name_ver
395  logical :: dbg_mode, print_version
396  integer :: alloc_size
397  continue
398  if ( dbg < 0 ) return
399  if (lfirst) call initialize
400  call debug( dbg_mode )
401  if ( dbg_mode ) then
402  name_ver = name
403  print_version = .false.
404  !---------------------------------
405  ! Print Version check
406  if (present(version)) then
407  if (.not. allocated(called_subname)) then
408  allocate(called_subname(1))
409  called_subname(1) = name
410  print_version = .true.
411  else
412  if (.not. strinclude(called_subname, trim(name))) then
413  alloc_size = size(called_subname)
414  allocate(called_subname_tmp(alloc_size))
415  called_subname_tmp = called_subname
416  deallocate(called_subname)
417  allocate(called_subname(alloc_size + 1))
418  called_subname(1:alloc_size) = called_subname_tmp
419  deallocate(called_subname_tmp)
420  called_subname(alloc_size + 1) = name
421  print_version = .true.
422  end if
423  end if
424  if (print_version) then
425  name_ver = cprintf('%c version=<%c>', &
426  & c1=trim(name), c2=trim(version))
427  end if
428  end if
429  !---------------------------------
430  ! Print Debug message
431  if (present(fmt)) then
432  cbuf = cprintf(fmt, i, r, d, l, n, c1, c2, c3, ca)
433  write(dbg, "(A, A, 'call ', A, ' : ', A)") trim(head), &
434  & repeat(indent, level), trim(name_ver), trim(cbuf)
435  else
436  write(dbg, "(A, A, 'call ',A)") trim(head), &
437  & repeat(indent, level), trim(name_ver)
438  endif
439  endif
440  ! call errtra ! --- for Fujitsu debug
441  if (level > size(table)) return
442  level = level + 1
443  table(level) = name
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118
Here is the call graph for this function:

◆ datad1dump()

subroutine dc_trace::datad1dump ( character(*), intent(in)  header,
real(dp), dimension(:), intent(in)  d,
integer, intent(in), optional  strlen,
integer, dimension(:), intent(in), optional  multi 
)

Definition at line 552 of file dc_trace.f90.

References append(), dbg, dc_types::dp, head, indent, level, meshead, and dc_types::string.

552  !
553  !== 1 次元データ出力
554  !
555  ! デバッグメッセージとして、多次元データ d (倍精度実数型)
556  ! を出力します。 文字型変数 header は出力時の頭文字として利用されます。
557  ! 整数型配列 strlen を与える事で、一行の文字数を指定できます
558  ! (デフォルトの文字数は dc_types#STRING で指定されています)。
559  ! 整数型配列 multi(:) を与えることで、
560  ! header の後ろに次元添字をつける事が可能です。
561  !
562  ! 利用例に関しては dc_trace の Example を参照して下さい。
563  !
564  !--
565  !== 開発者向け解説
566  !
567  ! このサブルーチンを用いても、このモジュール内で内部的に保持される
568  ! 整数型変数 level の値は変化しません。
569  !
570  !++
571  use dc_types, only: string, dp
572  use dc_string, only: tochar
573  character(*), intent(in) :: header ! データの名称
574  real(DP), intent(in) :: d(:) ! 倍精度実数1次元データ
575  integer, intent(in), optional:: strlen ! 一行の文字数
576  integer, intent(in), optional:: multi(:)! 上位の次元添字
577  integer :: i, j
578  character(STRING):: unit ! データ文字列
579  character(STRING):: unitbuf ! データ文字列バッファ
580  integer :: ucur ! unit に書かれた文字数
581  character(STRING):: cbuf ! read/write 文のバッファ
582  integer :: stat ! ステータス
583  logical :: first ! 1つ目のデータかどうか
584  integer :: begini ! 1つ目のデータの添字
585  integer :: endi ! 最後のデータの添字
586  character(STRING):: cmulti ! 次元添字用文字列
587  character(STRING):: cout ! 出力する文字列
588  character(STRING):: meshead_tmp
589  integer :: meshead_len
590  continue
591  if ( dbg < 0 ) return
592  ! 初期化
593  unit = ''
594  unitbuf = ''
595  ucur = 0
596  stat = 0
597  first = .true.
598  cmulti = ''
599  ! デバッグメッセージヘッダの作成。
600  if (level < 1) then
601  meshead_tmp = ''
602  meshead_len = 0
603  else
604  meshead_tmp = meshead
605  meshead_len = len(meshead)
606  endif
607  ! 次元添字用文字列を作成
608  if (present(multi)) then
609  do j = 1, size(multi)
610  cmulti = trim(cmulti) // ', ' // trim( tochar( multi(j) ) )
611  enddo
612  endif
613  i = 1
614  dim_1_loop : do
615  if (first) begini = i
616  endi = i
617  write(cbuf, "(g40.20)") d(i)
618  if (.not. first) cbuf = ', ' // adjustl(cbuf)
619  unitbuf = unit
620  call append(unit, ucur, trim(adjustl(cbuf)), stat, strlen)
621  if ( stat /= 0 .or. i == size( d(:) ) ) then
622  ! 一回目は、文字数オーバーでもそのまま出力。
623  if (first) then
624  cout = header // '(' &
625  & // trim(tochar(begini)) &
626  & // trim(cmulti) &
627  & // ')=' // trim(unit)
628  ! 二回目以降は、オーバーしたものは次回へ
629  elseif (stat /= 0 .and. begini == endi-1) then
630  cout = header // '(' &
631  & // trim(tochar(begini)) &
632  & // trim(cmulti) &
633  & // ')='// trim(unitbuf)
634  ! 1つ巻戻す
635  i = i - 1
636  elseif (stat /= 0 .and. begini /= endi-1) then
637  cout = header // '(' &
638  & // trim(tochar(begini)) // '-' &
639  & // trim(tochar(endi-1)) &
640  & // trim(cmulti) &
641  & // ')=' // trim(unitbuf)
642  ! 1つ巻戻す
643  i = i - 1
644  ! i が size(d) まで到達した場合もそのまま出力。
645  elseif ( i == size( d(:) ) ) then
646  cout = header // '(' &
647  & // trim(tochar(begini)) // '-' &
648  & // trim(tochar(endi)) &
649  & // trim(cmulti) &
650  & // ')='// trim(unit)
651  endif
652  write(dbg, "(A, A, A, A)") &
653  & trim(head), repeat( indent, max(level-1, 0) ), &
654  & meshead_tmp(1:meshead_len), trim(cout)
655  ! unit, unitbuf をクリア
656  unit = ''
657  unitbuf = ''
658  ucur = 0
659  first = .true.
660  else
661  first = .false.
662  endif
663  if (i == size( d(:) ) ) exit dim_1_loop
664  i = i + 1
665  enddo dim_1_loop
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
subroutine append(unitx, ucur, val, stat)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118
Here is the call graph for this function:

◆ datad2dump()

subroutine dc_trace::datad2dump ( character(*), intent(in)  header,
real(dp), dimension(:,:), intent(in)  d,
integer, intent(in), optional  strlen,
integer, dimension(:), intent(in), optional  multi 
)

Definition at line 668 of file dc_trace.f90.

References dbg, dc_types::dp, and dc_types::string.

668  !
669  !== 2 次元データ出力
670  !
671  ! 詳しくは DataDump または DataD1Dump を参照ください。
672  !
673  use dc_types, only: string, dp
674  character(*), intent(in) :: header ! データの名称
675  real(DP), intent(in) :: d(:,:) ! 倍精度実数2次元データ
676  integer, intent(in), optional:: strlen ! 一行の文字数
677  integer, intent(in), optional:: multi(:)! 上位の次元添字
678  integer, allocatable :: total(:)
679  integer :: j
680  continue
681  if ( dbg < 0 ) return
682  if (present(multi)) then
683  allocate( total(size(multi)+1) )
684  total(2:size(multi)+1) = multi(:)
685  else
686  allocate( total(1) )
687  endif
688  do j = 1, size( d(:,:), 2 )
689  total(1) = j
690  call datadump(header, d(:,j), strlen=strlen, multi=total(:))
691  enddo
692  deallocate( total )
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118

◆ datad3dump()

subroutine dc_trace::datad3dump ( character(*), intent(in)  header,
real(dp), dimension(:,:,:), intent(in)  d,
integer, intent(in), optional  strlen,
integer, dimension(:), intent(in), optional  multi 
)

Definition at line 695 of file dc_trace.f90.

References dbg, dc_types::dp, and dc_types::string.

695  !
696  !== 3 次元データ出力
697  !
698  ! 詳しくは DataDump または DataD1Dump を参照ください。
699  !
700  use dc_types, only: string, dp
701  character(*), intent(in) :: header ! データの名称
702  real(DP), intent(in) :: d(:,:,:)! 倍精度実数3次元データ
703  integer, intent(in), optional:: strlen ! 一行の文字数
704  integer, intent(in), optional:: multi(:)! 上位の次元添字
705  integer, allocatable :: total(:)
706  integer :: k
707  continue
708  if ( dbg < 0 ) return
709  if (present(multi)) then
710  allocate( total(size(multi)+1) )
711  total(2:size(multi)+1) = multi(:)
712  else
713  allocate( total(1) )
714  endif
715  do k = 1, size( d(:,:,:), 3 )
716  total(1) = k
717  call datadump(header, d(:,:,k), strlen=strlen, multi=total(:))
718  enddo
719  deallocate( total )
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118

◆ dbg_scratch()

subroutine, public dc_trace::dbg_scratch ( logical, intent(in)  on)

Definition at line 219 of file dc_trace.f90.

References dbg.

Referenced by sysdepabort().

219  !
220  !== デバッグメッセージの抹消
221  !
222  ! <b>動作未確認ですので利用の際にはご注意下さい。</b>
223  !
224  ! 論理型変数 on に .true. を与える事で、
225  ! 以降の デバッグメッセージを抹消する事が出来ます。
226  !
227  ! なお、論理型変数 on に <tt>.false.</tt> を 与える事で、
228  ! 直前に呼んだ Dbg_Scratch 以降のメッセージを
229  ! デバッグメッセージとして再び出力し、
230  ! 以降のデバッグメッセージも 出力されるようにします。
231  !
232  logical, intent(in):: on
233  integer, save:: saved_dbg = -1
234  logical:: x, p
235  character(80):: line
236  integer:: ios
237  continue
238  if (on) then
239  if (dbg < 0) return
240  saved_dbg = dbg
241  ! 有効な 1 〜 99 の装置番号の内の大きめの値を設定 (?)
242  dbg = 98
243  do
244  inquire(unit=dbg, exist=x, opened=p)
245  ! 装置番号 dbg が接続可能で、かつ未接続の場合
246  if (x .and. .not. p) then
247  ! 装置番号 deg をスクラッチファイルとして開く。
248  ! ※ スクラッチファイルとは、特殊な外部ファイルである。
249  ! これは名前なしの一時ファイルであり、開いている
250  ! 間だけ存在する。つまり、プログラムが終了すると
251  ! 存在しなくなる。
252  open(unit=dbg, status='SCRATCH')
253  ! 開く事が出来ればそれで終了。
254  return
255  endif
256  ! 装置番号 dbg が利用不可、または利用済の場合は 0 以下に
257  ! なるまで dbg - 1 して繰り返す。
258  dbg = dbg - 1
259  if (dbg < 0) exit
260  enddo
261  ! 装置番号 dbg が開けない場合、dbg と saved_dbg を初期化
262  dbg = saved_dbg
263  saved_dbg = -1
264  else
265  ! 以前に装置番号 dbg = 98〜0 でスクラッチファイルを開けてい
266  ! なければそれで終了
267  if (saved_dbg < 0) return
268  ! 装置番号 dbg に接続されたスクラッチファイルをその開始位置
269  ! に位置付ける。エラーが生じたら「100 continue」へ
270  rewind(dbg, err=100)
271  do
272  ! 装置番号 dbg に接続されたスクラッチファイルの一行を
273  ! line へ
274  read(dbg, '(A)', iostat=ios) line
275  if (ios /= 0) exit
276  ! line を装置番号 saved_dbg へ書き出す。
277  write(saved_dbg, '(A)', iostat=ios) trim(line)
278  if (ios /= 0) exit
279  enddo
280  100 continue
281  close(dbg, iostat=ios)
282  ! 最後に dbg と saved_dbg を初期化
283  dbg = saved_dbg
284  saved_dbg = -1
285  endif
Here is the caller graph for this function:

◆ dbgmessage()

subroutine, public dc_trace::dbgmessage ( character(*), intent(in)  fmt,
integer, dimension(:), intent(in), optional  i,
real, dimension(:), intent(in), optional  r,
real(dp), dimension(:), intent(in), optional  d,
logical, dimension(:), intent(in), optional  L,
integer, dimension(:), intent(in), optional  n,
character(*), intent(in), optional  c1,
character(*), intent(in), optional  c2,
character(*), intent(in), optional  c3,
character(*), dimension(:), intent(in), optional  ca 
)

Definition at line 509 of file dc_trace.f90.

References dbg, dc_types::dp, head, indent, level, meshead, and dc_types::string.

Referenced by actual_iorange_dump(), gtool_history_internal::append_attrs(), gtool_history_internal::copy_attrs(), dccaldateparsestr1(), dc_clock::dcclockcreate0(), dc_clock::dcclockgetd(), dc_clock::dcclockgetr(), dc_clock::dcclockpredict0(), dc_clock::dcclockputline0(), dc_clock::dcclockresult0(), dc_clock::dcclocksetname0(), dc_clock::dcclockstart0(), dc_clock::dcclockstop0(), gtdata_internal_map::dimord_skip_compact(), gdncfileclose(), gdncfiledatamode(), gdncfiledefinemode(), gdncfileinquirename(), gdncfilereopen(), gdncvarattrrewind(), gdncvarcreate(), gdncvarcreated(), gdncvarinquire(), gdncvarputchar(), gdncvarputdouble(), gdncvarputint(), gdncvarputreal(), gdncvarsearchinit(), gdncvarsearchnext(), getmatch(), gtdata_internal_map::gtvar_dump(), gtvaradddim(), gtvarclose(), gtvarcopyattrall(), gtvarcreate(), gtvarcreated(), gtvardeldim(), gtvarexchdim(), gtvargetpointerdouble1(), gtvargetpointerdouble2(), gtvargetpointerdouble3(), gtvargetpointerdouble4(), gtvargetpointerdouble5(), gtvargetpointerdouble6(), gtvargetpointerdouble7(), gtvargetpointerint1(), gtvargetpointerint2(), gtvargetpointerint3(), gtvargetpointerint4(), gtvargetpointerint5(), gtvargetpointerint6(), gtvargetpointerint7(), gtvargetpointerreal1(), gtvargetpointerreal2(), gtvargetpointerreal3(), gtvargetpointerreal4(), gtvargetpointerreal5(), gtvargetpointerreal6(), gtvargetpointerreal7(), gtvarinquire(), gtvarlimit_iiii(), gtvaropenbydimord(), gtvarputline(), gtvarslice(), gtvarslicenext(), gtvarxformbinary(), historyaddattrchar0(), historyaddattrdouble0(), historyaddattrdouble1(), historyaddattrint0(), historyaddattrint1(), historyaddattrlogical0(), historyaddattrreal0(), historyaddattrreal1(), historyaddvariable1(), historyaddvariable2(), historyautoaddvariable2(), historyaxisaddattr2char0(), historyaxisaddattr2double0(), historyaxisaddattr2double1(), historyaxisaddattr2int0(), historyaxisaddattr2int1(), historyaxisaddattr2logical0(), historyaxisaddattr2real0(), historyaxisaddattr2real1(), historyaxisaddattrchar0(), historyaxisaddattrdouble0(), historyaxisaddattrdouble1(), historyaxisaddattrint0(), historyaxisaddattrint1(), historyaxisaddattrlogical0(), historyaxisaddattrreal0(), historyaxisaddattrreal1(), historyaxisclear(), historyaxiscopy1(), historyaxiscopy2(), historyaxiscreate1(), historyaxiscreate2(), historyaxisinquire1(), historyaxisinquire2(), historyclose(), historycopy1(), historycopy2(), historycopyvariable1(), historycreate1(), historycreate2(), historycreate3(), historygetdouble0(), historygetdouble0pointer(), historygetdouble0pointertimed(), historygetdouble0pointertimei(), historygetdouble0pointertimer(), historygetdouble0timed(), historygetdouble0timei(), historygetdouble0timer(), historygetdouble1(), historygetdouble1pointer(), historygetdouble1pointertimed(), historygetdouble1pointertimei(), historygetdouble1pointertimer(), historygetdouble1timed(), historygetdouble1timei(), historygetdouble1timer(), historygetdouble2(), historygetdouble2pointer(), historygetdouble2pointertimed(), historygetdouble2pointertimei(), historygetdouble2pointertimer(), historygetdouble2timed(), historygetdouble2timei(), historygetdouble2timer(), historygetdouble3(), historygetdouble3pointer(), historygetdouble3pointertimed(), historygetdouble3pointertimei(), historygetdouble3pointertimer(), historygetdouble3timed(), historygetdouble3timei(), historygetdouble3timer(), historygetdouble4(), historygetdouble4pointer(), historygetdouble4pointertimed(), historygetdouble4pointertimei(), historygetdouble4pointertimer(), historygetdouble4timed(), historygetdouble4timei(), historygetdouble4timer(), historygetdouble5(), historygetdouble5pointer(), historygetdouble5pointertimed(), historygetdouble5pointertimei(), historygetdouble5pointertimer(), historygetdouble5timed(), historygetdouble5timei(), historygetdouble5timer(), historygetdouble6(), historygetdouble6pointer(), historygetdouble6pointertimed(), historygetdouble6pointertimei(), historygetdouble6pointertimer(), historygetdouble6timed(), historygetdouble6timei(), historygetdouble6timer(), historygetdouble7(), historygetdouble7pointer(), historygetdouble7pointertimed(), historygetdouble7pointertimei(), historygetdouble7pointertimer(), historygetdouble7timed(), historygetdouble7timei(), historygetdouble7timer(), historygetint0(), historygetint0pointer(), historygetint0pointertimed(), historygetint0pointertimei(), historygetint0pointertimer(), historygetint0timed(), historygetint0timei(), historygetint0timer(), historygetint1(), historygetint1pointer(), historygetint1pointertimed(), historygetint1pointertimei(), historygetint1pointertimer(), historygetint1timed(), historygetint1timei(), historygetint1timer(), historygetint2(), historygetint2pointer(), historygetint2pointertimed(), historygetint2pointertimei(), historygetint2pointertimer(), historygetint2timed(), historygetint2timei(), historygetint2timer(), historygetint3(), historygetint3pointer(), historygetint3pointertimed(), historygetint3pointertimei(), historygetint3pointertimer(), historygetint3timed(), historygetint3timei(), historygetint3timer(), historygetint4(), historygetint4pointer(), historygetint4pointertimed(), historygetint4pointertimei(), historygetint4pointertimer(), historygetint4timed(), historygetint4timei(), historygetint4timer(), historygetint5(), historygetint5pointer(), historygetint5pointertimed(), historygetint5pointertimei(), historygetint5pointertimer(), historygetint5timed(), historygetint5timei(), historygetint5timer(), historygetint6(), historygetint6pointer(), historygetint6pointertimed(), historygetint6pointertimei(), historygetint6pointertimer(), historygetint6timed(), historygetint6timei(), historygetint6timer(), historygetint7(), historygetint7pointer(), historygetint7pointertimed(), historygetint7pointertimei(), historygetint7pointertimer(), historygetint7timed(), historygetint7timei(), historygetint7timer(), historygetreal0(), historygetreal0pointer(), historygetreal0pointertimed(), historygetreal0pointertimei(), historygetreal0pointertimer(), historygetreal0timed(), historygetreal0timei(), historygetreal0timer(), historygetreal1(), historygetreal1pointer(), historygetreal1pointertimed(), historygetreal1pointertimei(), historygetreal1pointertimer(), historygetreal1timed(), historygetreal1timei(), historygetreal1timer(), historygetreal2(), historygetreal2pointer(), historygetreal2pointertimed(), historygetreal2pointertimei(), historygetreal2pointertimer(), historygetreal2timed(), historygetreal2timei(), historygetreal2timer(), historygetreal3(), historygetreal3pointer(), historygetreal3pointertimed(), historygetreal3pointertimei(), historygetreal3pointertimer(), historygetreal3timed(), historygetreal3timei(), historygetreal3timer(), historygetreal4(), historygetreal4pointer(), historygetreal4pointertimed(), historygetreal4pointertimei(), historygetreal4pointertimer(), historygetreal4timed(), historygetreal4timei(), historygetreal4timer(), historygetreal5(), historygetreal5pointer(), historygetreal5pointertimed(), historygetreal5pointertimei(), historygetreal5pointertimer(), historygetreal5timed(), historygetreal5timei(), historygetreal5timer(), historygetreal6(), historygetreal6pointer(), historygetreal6pointertimed(), historygetreal6pointertimei(), historygetreal6pointertimer(), historygetreal6timed(), historygetreal6timei(), historygetreal6timer(), historygetreal7(), historygetreal7pointer(), historygetreal7pointertimed(), historygetreal7pointertimei(), historygetreal7pointertimer(), historygetreal7timed(), historygetreal7timei(), historygetreal7timer(), historyinquire1(), historyinquire2(), historyinquire3(), historyinquire4(), historyputaxismpidouble(), historyputaxismpiint(), historyputaxismpireal(), historyputchar0(), historyputcharex(), historyputdouble0(), historyputdouble1(), historyputdouble2(), historyputdouble3(), historyputdouble4(), historyputdouble5(), historyputdouble6(), historyputdouble7(), historyputdoubleex(), historyputint0(), historyputint1(), historyputint2(), historyputint3(), historyputint4(), historyputint5(), historyputint6(), historyputint7(), historyputintex(), historyputreal0(), historyputreal1(), historyputreal2(), historyputreal3(), historyputreal4(), historyputreal5(), historyputreal6(), historyputreal7(), historyputrealex(), historysettime(), historyvarinfoaddattr2char0(), historyvarinfoaddattr2double0(), historyvarinfoaddattr2double1(), historyvarinfoaddattr2int0(), historyvarinfoaddattr2int1(), historyvarinfoaddattr2logical0(), historyvarinfoaddattr2real0(), historyvarinfoaddattr2real1(), historyvarinfoaddattrchar0(), historyvarinfoaddattrdouble0(), historyvarinfoaddattrdouble1(), historyvarinfoaddattrint0(), historyvarinfoaddattrint1(), historyvarinfoaddattrlogical0(), historyvarinfoaddattrreal0(), historyvarinfoaddattrreal1(), historyvarinfoclear0(), historyvarinfocopy1(), historyvarinfocopy2(), historyvarinfocreate1(), historyvarinfocreate2(), historyvarinfoinquire1(), historyvarinfoinquire2(), hstnmlinfoadd(), hstnmlinfoclose(), hstnmlinfodelete(), gtool_historyauto_internal::hstvarsoutputcheck(), internal_get_allcount(), internal_get_alldims(), internal_get_rank(), internal_get_size(), gtool_history_internal::lookup_dimension(), lookup_growable_url(), gtool_history_internal::lookup_var_or_dim(), gtool_history_internal::lookup_variable(), gtool_history_internal::lookup_variable_ord(), gtdata_internal_map::map_dup(), gtdata_internal_map::maptabdelete(), timegoahead(), dc_url::url_resolve_c(), value_to_index(), gtdata_internal_vartable::vartable_dump(), gtdata_internal_vartable::vartableadd(), gtdata_netcdf_internal::vtable_add(), and gtdata_netcdf_internal::vtable_delete().

509  !
510  !== デバッグ用メッセージ出力
511  !
512  ! フォーマット文字列 fmt に従ってデバッグメッセージを出力します。
513  ! fmt とそれ以降の引数に関する書式は dc_string#CPrintf
514  ! の説明を参照して下さい。
515  !
516  ! 利用例に関しては dc_trace の Example を参照して下さい。
517  !
518  !--
519  !== 開発者向け解説
520  !
521  ! このサブルーチンを用いても、このモジュール内で内部的に保持される
522  ! 整数型変数 level の値は変化しません。
523  !
524  !++
525  use dc_types, only: string, dp
526  use dc_string, only: cprintf, tochar
527  character(*), intent(in) :: fmt
528  integer, intent(in), optional:: i(:), n(:)
529  real, intent(in), optional:: r(:)
530  real(DP), intent(in), optional:: d(:)
531  logical, intent(in), optional:: l(:)
532  character(*), intent(in), optional:: c1, c2, c3
533  character(*), intent(in), optional:: ca(:)
534  character(STRING):: cbuf
535  character(STRING):: meshead_tmp
536  integer :: meshead_len
537  continue
538  if ( dbg < 0 ) return
539  cbuf = cprintf(fmt, i, r, d, l, n, c1, c2, c3, ca)
540  if (level < 1) then
541  meshead_tmp = ''
542  meshead_len = 0
543  else
544  meshead_tmp = meshead
545  meshead_len = len(meshead)
546  endif
547  write(dbg, "(A, A, A, A)") &
548  & trim(head), repeat( indent, max(level-1, 0) ), &
549  & meshead_tmp(1:meshead_len), trim(cbuf)
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118

◆ dctracedebug()

subroutine dc_trace::dctracedebug ( logical, intent(out)  dbg_mode)

Definition at line 333 of file dc_trace.f90.

References dbg.

333  !
334  !== デバックモードかどうかの診断
335  !
336  ! SetDebugでデバッグモードになっている場合には .true. が、
337  ! デバッグモードでない場合には .false. が返ります。
338  !
339  logical, intent(out):: dbg_mode
340  dbg_mode = dbg >= 0

◆ endsub()

subroutine, public dc_trace::endsub ( character(*), intent(in)  name,
character(*), intent(in), optional  fmt,
integer, dimension(:), intent(in), optional  i,
real, dimension(:), intent(in), optional  r,
real(dp), dimension(:), intent(in), optional  d,
logical, dimension(:), intent(in), optional  L,
integer, dimension(:), intent(in), optional  n,
character(*), intent(in), optional  c1,
character(*), intent(in), optional  c2,
character(*), intent(in), optional  c3,
character(*), dimension(:), intent(in), optional  ca 
)

Definition at line 446 of file dc_trace.f90.

References dbg, dc_types::dp, head, indent, initialize(), level, lfirst, dc_types::string, and table.

Referenced by adjust_slice(), gtool_history_internal::append_attrs(), gtool_history_internal::copy_attrs(), dccalconvertbyunit1(), dccalconvertbyunit2(), dccalconverttoday1(), dccalconverttoday2(), dccalconverttohour1(), dccalconverttohour2(), dccalconverttomin1(), dccalconverttomin2(), dccalconverttosec1(), dccalconverttosec2(), dccalcreate1(), dccalcreate2(), dccaldatecreate1(), dccaldatecreate2(), dccaldatecurrent1(), dccaldatedifference1(), dccaldateevalid1(), dccaldateevalid2(), dccaldateevalym2ym1(), dccaldateevalym2ym2(), dccaldateevalymdhms1(), dccaldateevalymdhms2(), dccaldateinquire1(), dccaldateinquire2(), dccaldateparsestr1(), dccaldefault1(), dccalinquire1(), dccalparseunit1(), dc_clock::dcclockclose0(), dc_clock::dcclockcreate0(), dc_clock::dcclockgetd(), dc_clock::dcclockgetr(), dc_clock::dcclockpredict0(), dc_clock::dcclockputline0(), dc_clock::dcclockresult0(), dc_clock::dcclocksetname0(), dc_clock::dcclockstart0(), dc_clock::dcclockstop0(), dcdatetimecreate1(), dcdatetimeeval1(), dcdatetimeputline(), dcdatetimesetcaltype(), dcdatetimesetsecofday(), dcdatetimesetzone(), dcdifftimecreate1(), dcdifftimecreate2d(), dcdifftimeeval1(), dcdifftimeputline(), dc_scaledsec::dcscaledseccreated(), dc_scaledsec::dcscaledsecputline(), dc_iounit::fileopen(), gdncattrgetchar(), gdncfileclose(), gdncfiledefinemode(), gdncfileinquirename(), gdncfileopen(), gdncfilereopen(), gdncsearchdim(), gdncvarcreate(), gdncvarcreated(), gdncvarinquire(), gdncvaropen(), gdncvarsearchinit(), gdncvarsearchnext(), getmatch(), gtvaradddim(), gtvarclose(), gtvarcopyattr(), gtvarcopyattrall(), gtvarcopydim(), gtvarcopyvalue(), gtvarcreate(), gtvarcreatecopyc(), gtvarcreated(), gtvardeldim(), gtvarexchdim(), gtvargetattrcc(), gtvarinquire(), gtvarinquire2(), gtvarinquirea(), gtvarinquired(), gtvarlimit(), gtvarlimit_iiii(), gtvaropen(), gtvaropenbydimord(), gtvarputattrchar(), gtvarputline(), gtvarsearchinit(), gtvarsearchnext(), gtvarslice(), gtvarslicec(), gtvarslicenext(), gtvarxformbinary(), historyaddattrchar0(), historyaddattrdouble0(), historyaddattrdouble1(), historyaddattrint0(), historyaddattrint1(), historyaddattrlogical0(), historyaddattrreal0(), historyaddattrreal1(), historyaddvariable1(), historyaddvariable2(), historyautoaddattrchar0(), historyautoaddattrdouble0(), historyautoaddattrdouble1(), historyautoaddattrint0(), historyautoaddattrint1(), historyautoaddattrlogical0(), historyautoaddattrreal0(), historyautoaddattrreal1(), historyautoaddvariable1(), historyautoaddvariable2(), historyautoaddweightdouble(), historyautoaddweightint(), historyautoaddweightreal(), historyautoallvarfix(), historyautoclose1(), historyautocreate1(), historyautocreate2(), historyautocreate3(), historyautoputaxisdouble(), historyautoputaxisint(), historyautoputaxismpidouble(), historyautoputaxismpiint(), historyautoputaxismpireal(), historyautoputaxisreal(), historyautoputdouble0(), historyautoputdouble1(), historyautoputdouble2(), historyautoputdouble3(), historyautoputdouble4(), historyautoputdouble5(), historyautoputdouble6(), historyautoputdouble7(), historyautoputint0(), historyautoputint1(), historyautoputint2(), historyautoputint3(), historyautoputint4(), historyautoputint5(), historyautoputint6(), historyautoputint7(), historyautoputreal0(), historyautoputreal1(), historyautoputreal2(), historyautoputreal3(), historyautoputreal4(), historyautoputreal5(), historyautoputreal6(), historyautoputreal7(), historyaxisaddattr2char0(), historyaxisaddattr2double0(), historyaxisaddattr2double1(), historyaxisaddattr2int0(), historyaxisaddattr2int1(), historyaxisaddattr2logical0(), historyaxisaddattr2real0(), historyaxisaddattr2real1(), historyaxisaddattrchar0(), historyaxisaddattrdouble0(), historyaxisaddattrdouble1(), historyaxisaddattrint0(), historyaxisaddattrint1(), historyaxisaddattrlogical0(), historyaxisaddattrreal0(), historyaxisaddattrreal1(), historyaxisclear(), historyaxiscopy1(), historyaxiscopy2(), historyaxiscreate1(), historyaxiscreate2(), historyaxisinquire1(), historyaxisinquire2(), historyclose(), historycopy1(), historycopy2(), historycopyvariable1(), historycreate1(), historycreate2(), historycreate3(), historygettattrchar0(), historygettattrdouble0(), historygettattrdouble1(), historygettattrint0(), historygettattrint1(), historygettattrreal0(), historygettattrreal1(), historyinquire1(), historyinquire2(), historyinquire3(), historyinquire4(), historyputaxismpidouble(), historyputaxismpiint(), historyputaxismpireal(), historyputchar0(), historyputcharex(), historyputdouble0(), historyputdouble1(), historyputdouble2(), historyputdouble3(), historyputdouble4(), historyputdouble5(), historyputdouble6(), historyputdouble7(), historyputdoubleex(), historyputint0(), historyputint1(), historyputint2(), historyputint3(), historyputint4(), historyputint5(), historyputint6(), historyputint7(), historyputintex(), historyputline(), historyputreal0(), historyputreal1(), historyputreal2(), historyputreal3(), historyputreal4(), historyputreal5(), historyputreal6(), historyputreal7(), historyputrealex(), historysettime(), historyvarinfoaddattr2char0(), historyvarinfoaddattr2double0(), historyvarinfoaddattr2double1(), historyvarinfoaddattr2int0(), historyvarinfoaddattr2int1(), historyvarinfoaddattr2logical0(), historyvarinfoaddattr2real0(), historyvarinfoaddattr2real1(), historyvarinfoaddattrchar0(), historyvarinfoaddattrdouble0(), historyvarinfoaddattrdouble1(), historyvarinfoaddattrint0(), historyvarinfoaddattrint1(), historyvarinfoaddattrlogical0(), historyvarinfoaddattrreal0(), historyvarinfoaddattrreal1(), historyvarinfoclear0(), historyvarinfocopy1(), historyvarinfocopy2(), historyvarinfocreate1(), historyvarinfocreate2(), historyvarinfoinquire1(), historyvarinfoinquire2(), gtool_historyauto_internal::hstfilecreate(), hstnmlinfoadd(), hstnmlinfoallnamevalid(), hstnmlinfoallvarinicheck(), hstnmlinfoassocgthist(), hstnmlinfoclose(), hstnmlinfocreate(), hstnmlinfodelete(), hstnmlinfoenddefine(), hstnmlinfogetnames(), hstnmlinfoinquire(), gtool_history_nmlinfo_internal::hstnmlinfolistlast(), gtool_history_nmlinfo_internal::hstnmlinfolistnext(), gtool_history_nmlinfo_internal::hstnmlinfolistsearch(), hstnmlinfooutputstepdisable(), hstnmlinfoputline(), hstnmlinforedefine(), hstnmlinforesetdefault(), hstnmlinfosetvalidname(), gtool_historyauto_internal::hstvarsoutputcheck(), gtool_history_internal::lookup_dimension(), lookup_growable_url(), gtool_history_internal::lookup_var_or_dim(), gtool_history_internal::lookup_variable(), gtool_history_internal::lookup_variable_ord(), lookupequivalent(), map_finished(), timegoahead(), dc_url::url_resolve_c(), and value_to_index().

446  !
447  !== 副プログラム終了のメッセージ出力
448  !
449  ! 文字型変数 name に与えた副プログラム名を以下のように出力します。
450  !
451  ! # end name
452  !
453  ! BeginSub に対して一対一対応していますので、name には対応する
454  ! BeginSub の引数 name と同じものを与えて下さい。
455  !
456  ! また、文字型変数 fmt およびそれ以降の引数を与える事で、
457  ! 以下のように付加メッセージも出力可能です。 fmt
458  ! とそれ以降の引数に関する書式は dc_string#CPrintf
459  ! の説明を参照して下さい。
460  !
461  ! # end name fmt
462  !
463  ! 利用例に関しては dc_trace の Usage および Exampleを参照してください。
464  !--
465  !== 開発者向け解説
466  !
467  ! このサブルーチンにより, このモジュール内で内部的に保持される
468  ! 整数型変数 level の値が 1 減ります。
469  !
470  !++
471  use dc_types, only: string, dp
472  use dc_string, only: cprintf
473  character(*), intent(in) :: name
474  character(*), intent(in), optional:: fmt
475  integer, intent(in), optional:: i(:), n(:)
476  real, intent(in), optional:: r(:)
477  real(DP), intent(in), optional:: d(:)
478  logical, intent(in), optional:: l(:)
479  character(*), intent(in), optional:: c1, c2, c3
480  character(*), intent(in), optional:: ca(:)
481  character(STRING):: cbuf
482  logical:: debug_mode
483  continue
484  if ( dbg < 0 ) return
485  if (lfirst) call initialize
486  ! call errtra ! --- for Fujitsu debug
487  if (level <= 0) then
488  write(*, "(A, 'Warning EndSub[',A,'] without BeginSub')") &
489  & trim(head), trim(name)
490  else if (name /= table(level)) then
491  write(*, "(A, 'Warning EndSub[',A,'] but tos[',A,']')") &
492  & trim(head), trim(name), trim(table(level))
493  else
494  level = level - 1
495  endif
496  call debug( debug_mode )
497  if ( debug_mode ) then
498  if (present(fmt)) then
499  cbuf = cprintf(fmt, i, r, d, l, n, c1, c2, c3, ca)
500  write(dbg, "(A, A, 'end ', A, ' : ', A)") trim(head), &
501  & repeat(indent, level), trim(name), trim(cbuf)
502  else
503  write(dbg, "(A, A, 'end ', A)") trim(head), &
504  & repeat(indent, level), trim(name)
505  endif
506  endif
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118
Here is the call graph for this function:

◆ initialize()

subroutine dc_trace::initialize ( )
private

Definition at line 343 of file dc_trace.f90.

References lfirst, and table.

Referenced by beginsub(), and endsub().

343  !
344  ! 初期化
345  !
346  table(:) = ' '
347  lfirst = .false.
Here is the caller graph for this function:

◆ setdebug()

subroutine, public dc_trace::setdebug ( integer, intent(in), optional  debug)

Definition at line 288 of file dc_trace.f90.

References dbg, head, dc_types::stderr, and dc_types::stdout.

Referenced by dc_args::dcargsdebug0().

288  use dc_types, only: stdout, stderr
289  implicit none
290  !
291  !== デバッグモードをオンオフ
292  !
293  ! デバッグメッセージを出力したい時にこのサブルーチンを呼びます。
294  !
295  ! 整数型変数 debug が与えられる場合は、その装置番号 debug に、
296  ! 以降のサブルーチンによるデバッグメッセージを出力するようにします。
297  ! debug が与えられない場合、装置番号 0 (標準エラー出力)
298  ! にデバッグメッセージが出力されるようになります。
299  ! 装置番号 0 への出力が成功しない場合は代わりに
300  ! 装置番号 6 (標準出力) にデバッグメッセージが出力されるようになります。
301  !
302  ! debug に負の整数を与える場合、デバッグモードが解除され、
303  ! 以降デバッグメッセージは出力されません。
304  !
305  ! なお、この SetDebug を呼んだ際にも、装置番号 debug
306  ! に以下のメッセージ が表示されます。
307  !
308  ! #SetDebug: dbg = debug
309  !
310  integer, intent(in), optional:: debug
311  integer:: ios
312  continue
313  if (present(debug)) then
314  ! debug が与えられる時は装置番号として deg を用いる。
315  dbg = debug
316  write(dbg, "(A, 'SetDebug: dbg =', i4)", iostat=ios) &
317  & trim(head), dbg
318  if (ios == 0) return
319  else
320  ! debug が与えられ無い時は装置番号 0 (標準エラー出力)
321  dbg = stderr
322  write(dbg, "(A, 'SetDebug: dbg = ', I0)", iostat=ios) trim(head), dbg
323  if (ios == 0) return
324  ! 装置番号 0 への出力が失敗したら装置番号 6 (標準出力)
325  dbg = stdout
326  write(dbg, "(A, 'SetDebug: dbg = ', I0)", iostat=ios) trim(head), dbg
327  if (ios == 0) return
328  endif
329  ! 例外処理として dbg の初期化
330  dbg = -1
integer, parameter, public stderr
標準エラー出力の装置番号
Definition: dc_types.f90:103
integer, parameter, public stdout
標準出力の装置番号
Definition: dc_types.f90:98
種別型パラメタを提供します。
Definition: dc_types.f90:49
Here is the caller graph for this function:

◆ sublevel()

integer function, public dc_trace::sublevel ( )

Definition at line 210 of file dc_trace.f90.

References level.

210  !
211  !== 副プログラムの階層レベルを返す
212  !
213  ! 副プログラムの階層レベルを返します。 レベルのデフォルトは 0 で、
214  ! BeginSub によりレベルは 1 増え、 EndSub によりレベルは 1 減ります。
215  !
216  result = level

Variable Documentation

◆ called_subname

character(string), dimension(:), allocatable, save dc_trace::called_subname
private

Definition at line 192 of file dc_trace.f90.

Referenced by beginsub().

192  character(STRING), save, allocatable:: called_subname(:), &
193  & called_subname_tmp(:)

◆ called_subname_tmp

character(string), dimension(:), allocatable, save dc_trace::called_subname_tmp
private

Definition at line 192 of file dc_trace.f90.

Referenced by beginsub().

◆ dbg

integer, save, public dc_trace::dbg = -1

Definition at line 184 of file dc_trace.f90.

Referenced by beginsub(), datad1dump(), datad2dump(), datad3dump(), dbg_scratch(), dbgmessage(), dctracedebug(), endsub(), and setdebug().

184  integer, save, public :: dbg = -1 ! SetDebug で設定された

◆ head

character(1), parameter dc_trace::head = '#'
private

Definition at line 197 of file dc_trace.f90.

Referenced by beginsub(), datad1dump(), dbgmessage(), endsub(), and setdebug().

197  character(1), parameter:: head = '#' ! 行頭文字

◆ indent

character(2), parameter dc_trace::indent = '| '
private

Definition at line 198 of file dc_trace.f90.

Referenced by beginsub(), datad1dump(), dbgmessage(), and endsub().

198  character(2), parameter :: indent = '| ' ! 字下げ文字

◆ level

integer, save dc_trace::level = 0
private

Definition at line 187 of file dc_trace.f90.

Referenced by beginsub(), datad1dump(), dbgmessage(), endsub(), and sublevel().

187  integer, save :: level = 0 ! サブルーチンレベル

◆ lfirst

logical, save dc_trace::lfirst = .true.
private

Definition at line 182 of file dc_trace.f90.

Referenced by beginsub(), endsub(), and initialize().

182  logical, save :: lfirst = .true.

◆ meshead

character(2), parameter dc_trace::meshead = '|-'
private

Definition at line 199 of file dc_trace.f90.

Referenced by datad1dump(), and dbgmessage().

199  character(2), parameter :: meshead = '|-' ! DbgMessage 用行頭文字

◆ table

character(token), dimension(trace_stack_size), save dc_trace::table
private

Definition at line 190 of file dc_trace.f90.

Referenced by beginsub(), endsub(), and initialize().

190  character(TOKEN), save:: table(trace_stack_size)

◆ trace_stack_size

integer, parameter dc_trace::trace_stack_size = 128
private

Definition at line 188 of file dc_trace.f90.

188  integer, parameter :: trace_stack_size = 128