Namelist

A namelist group.

Declaration

Syntax

Namelist(symbol_table parent_symtab, identifier group_name,
    symbol* var_list)

Arguments

Argument

Description

parent_symtab

the symbol table this group is stored in.

group_name

the name of the group, the name written in nml=name.

var_list

the variables of the group, in declaration order.

Return values

None.

Description

A namelist group names a list of variables so that FileRead and FileWrite can transfer all of them at once, matching each item in the file by name. The nml member of those statements points at this symbol.

The group is a symbol because it is looked up by name and because its members are the variable symbols themselves: namelist input assigns to them by name at run time.

Examples

(Namelist
  :parent_symtab 1
  :group_name "nml"
  :var_list [
    (SymbolRef 1 "x")
    (SymbolRef 1 "y")
  ]
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "main" (Program
        :symtab (SymbolTable
          :id 1
          :symbols {
            "nml" (Namelist
              :parent_symtab 1
              :group_name "nml"
              :var_list [
                (SymbolRef 1 "x")
                (SymbolRef 1 "y")
              ]
            )
            "x" (Variable
              :parent_symtab 1
              :name "x"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Integer
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
            "y" (Variable
              :parent_symtab 1
              :name "y"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Real
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
          }
        )
        :name "main"
        :dependencies []
        :body [
          (FileWrite
            :label -1
            :unit (IntegerConstant
              :n 6
              :type (Integer
                :kind 4
              )
              :intboz_type :Decimal
            )
            :iomsg nil
            :iostat nil
            :id nil
            :values []
            :separator nil
            :end nil
            :overloaded nil
            :is_formatted true
            :nml (SymbolRef 1 "nml")
            :rec nil
            :pos nil
            :asynchronous nil
          )
        ]
      )
    }
  )
  :items []
)

See Also

FileRead, FileWrite, Variable