gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gtool_history_nmlinfo_internal::listsearch Interface Reference

Public Member Functions

subroutine hstnmlinfolistsearch (gthstnml_list, name, previous, next, err)
 

Detailed Description

Definition at line 59 of file gtool_history_nmlinfo_internal.f90.

Member Function/Subroutine Documentation

◆ hstnmlinfolistsearch()

subroutine gtool_history_nmlinfo_internal::listsearch::hstnmlinfolistsearch ( type(gthst_nmlinfo_entry), pointer  gthstnml_list,
character(*), intent(in)  name,
type(gthst_nmlinfo_entry), optional, pointer  previous,
type(gthst_nmlinfo_entry), optional, pointer  next,
logical, intent(out), optional  err 
)

Search list entry by name

gthstnml_list (type GTHST_NMLINFO_ENTRY) that is a list structure is received, and gthstnml_list is reassociated to the entry that has a value that is same as argument name, and returned. If the entry is not found, null is returned. If gthstnml_list is null from the beginning, null is returned.

If previous is given, an entry previous to the above entry is associated. If previous entries are not found, null is returned.

If next is given, an entry next to the above entry is associated. If next entries are not found, null is returned.

Parameters
[in,out]gthstnml_listList entry pointer
[in]nameVariable identifier
[out]previousPrevious entry pointer (optional)
[out]nextNext entry pointer (optional)
[out]errError flag (optional)

Definition at line 293 of file gtool_history_nmlinfo_internal.f90.

297 use dc_trace, only: beginsub, endsub
298 use dc_error, only: storeerror, dc_noerr
299 use dc_types, only: string
300 implicit none
301 type(GTHST_NMLINFO_ENTRY), pointer:: gthstnml_list
302 ! (inout)
303 character(*), intent(in):: name
304 ! 変数名.
305 ! 先頭の空白は無視されます.
306 !
307 ! Variable identifier.
308 ! Blanks at the head of the name are ignored.
309 type(GTHST_NMLINFO_ENTRY), pointer, optional:: previous
310 ! (out)
311 type(GTHST_NMLINFO_ENTRY), pointer, optional:: next
312 ! (out)
313 logical, intent(out), optional:: err
314 ! 例外処理用フラグ.
315 ! デフォルトでは, この手続き内でエラーが
316 ! 生じた場合, プログラムは強制終了します.
317 ! 引数 *err* が与えられる場合,
318 ! プログラムは強制終了せず, 代わりに
319 ! *err* に .true. が代入されます.
320 !
321 ! Exception handling flag.
322 ! By default, when error occur in
323 ! this procedure, the program aborts.
324 ! If this *err* argument is given,
325 ! .true. is substituted to *err* and
326 ! the program does not abort.
327
328 !-----------------------------------
329 ! 作業変数
330 ! Work variables
331 integer:: stat
332 character(STRING):: cause_c
333 character(*), parameter:: subname = 'HstNmlInfoListSearch'
334 continue
335 call beginsub( subname )
336 stat = dc_noerr
337 cause_c = ''
338
339 !-----------------------------------------------------------------
340 ! 空状態の場合は何もしないで返す
341 ! If null, return without change
342 !-----------------------------------------------------------------
343 if ( .not. associated( gthstnml_list ) ) goto 999
344
345 !-----------------------------------------------------------------
346 ! 引数 *name* と同じ *name* を持つエントリを探査
347 ! The entry that has *name* that is same as argument *name* is searched
348 !-----------------------------------------------------------------
349 if ( present( previous ) ) nullify( previous )
350 if ( present( next ) ) nullify( next )
351 if ( trim( adjustl( gthstnml_list % name ) ) == trim( adjustl( name ) ) ) then
352 if ( present( next ) ) then
353 next => gthstnml_list % next
354 end if
355 goto 999
356 end if
357
358 do while ( associated( gthstnml_list ) )
359 if ( present( previous ) ) previous => gthstnml_list
360 call listnext( gthstnml_list = gthstnml_list ) ! (inout)
361 if ( .not. associated( gthstnml_list ) ) goto 999
362 if ( trim( adjustl( gthstnml_list % name ) ) == trim( adjustl( name ) ) ) then
363 if ( present( next ) ) then
364 next => gthstnml_list % next
365 end if
366 goto 999
367 end if
368 end do
369
370 !-----------------------------------------------------------------
371 ! 終了処理, 例外処理
372 ! Termination and Exception handling
373 !-----------------------------------------------------------------
374999 continue
375 call storeerror( stat, subname, err, cause_c )
376 call endsub( subname )
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137

References dc_trace::beginsub(), dc_error::dc_noerr, dc_trace::endsub(), dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function:

The documentation for this interface was generated from the following file: