store(3f) - [ARGUMENTS:M_kracken] add or replace value for specified name in dictionary(if allow=add add name if needed) (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
See Also
Author
License
subroutine store(name1,value1,allow1,ier)
character(len=*),intent(in) :: name1 class(*),intent(in) :: value1 character(len=*),intent(in) :: allow1 integer,intent(out) :: ier
Normally a command string and the associated values are placed in the dictionary by a call to KRACKEN(3f) when parsing a command line, or DISSECT(3f) and PARSE(3f) when creating input file interpreters. Rarely there may be a need to place <NAME,VALUE> pairs directly into the command dictionary, so this routine is public in the M_kracken(3fm) module. However, *this routine is primarily assumed to be an internal procedure*.
If add or append and the value is not blank it will be APPENDED to the current value. If define or replace it will replace the value instead of appending to it.
NAME1 name in dictionary of form VERB_KEYWORD VALUE1 value to be associated to NAME1. Value may be of type INTEGER, REAL, DOUBLEPRECISION, LOGICAL or CHARACTER. ALLOW1 flag to allow new VERB_KEYWORD name being added. Should be
define add or replace a new VERB_KEYWORD entry and value add add or append to a new VERB_KEYWORD entry and value no_add or append append to an *EXISTING* entry value replace replace an *EXISTING* entry
IER flag if error occurs in adding or setting value
Sample program:
program demo_store use M_kracken, only : store, show implicit none integer :: ier ! The following should be equivalent to ! call kracken(MY, & ! & -STRING My string value & ! & -INTEGER 1234 & ! & -INTEGER 0987654321 & ! & -REAL 1234.5678 & ! & -DOUBLE 123.4567d8 & ! & -LOGICAL T & ! & call store(MY_STRING,My string value,add,ier) if(ier.ne.0)write(*,*)ERROR: could not store MY_STRING ier=,ier ! now the verb MY is defined with the option -STRING so the ! dictionary has MY_STRING=My string value definedResults:! this will be an error because MY does not have the -INTEGER ! keyword defined call store(MY_INTEGER,12345678,no_add,ier)
! now define MY_INTEGER call store(MY_INTEGER,1234,add,ier) ! if no_add it will APPEND to current string call store(MY_INTEGER,987654321,add,ier)
call store(MY_REAL,1234.5678,add,ier) call store(MY_DOUBLE,123.4567d8,add,ier) call store(MY_LOGICAL,.true.,add,ier)
call show(MY,.false.,0) write(*,*)repeat(=,76)
! if replace is used REPLACE instead of APPEND to current value call store(MY_INTEGER,987654321,replace,ier) call show(MY,.false.,0) write(*,*)repeat(=,76)
! replace can only replace an existing entry, not add one call store(MY_UNKNOWN,987654321,replace,ier) call show(MY,.false.,0) write(*,*)repeat(=,76)
end program demo_store
>######################################################## >error: UNKNOWN OPTION -INTEGER >MY parameters are > -STRING My string value >######################################################## > MY_STRING = My string value > MY_REAL = 1234.5677 > MY_LOGICAL = T > MY_INTEGER = 1234 987654321 > MY_DOUBLE = 12345670000.000000 > ======================================================================= > MY_STRING = My string value > MY_REAL = 1234.5677 > MY_LOGICAL = T > MY_INTEGER = 987654321 > MY_DOUBLE = 12345670000.000000 > ======================================================================= >######################################################## >error: UNKNOWN OPTION -UNKNOWN >MY parameters are > -STRING My string value > -REAL 1234.5677 > -LOGICAL T > -INTEGER 987654321 > -DOUBLE 12345670000.000000 >######################################################## > MY_STRING = My string value > MY_REAL = 1234.5677 > MY_LOGICAL = T > MY_INTEGER = 987654321 > MY_DOUBLE = 12345670000.000000 > =======================================================================
dget(3f), dgets(3f), iget(3f), igets(3f), lget(3f), lgets(3f), rget(3f), rgets(3f), sget(3f), sgets(3f), retrev(3f)
M_kracken(3f), kracken(3f) parse(3f), dissect(3f), store(3f), setprompts(3f), show(3f)
John S. Urban
Public Domain
Nemo Release 3.1 | store (3) | February 23, 2025 |