TABLE OF CONTENTS


::pwtk::input::namelistGetPWTK

SYNOPSIS

proc ::pwtk::input::namelistGetPWTK {name} {

PURPOSE

Return the namelist as a PWTK script.

This routine handles both, namelist and namelist.affix

ARGUMENTS

SOURCE

    variable namelist
    variable card

    if { [info exists namelist($name)] } {

        set result "$name \{\n"
        set vars [namelistVars_ $name]
            
        # get the maximum length of a variable name
        set maxl 0
        foreach var $vars {
            set maxl [expr { [string length $var] > $maxl ? [string length $var] : $maxl }]
        }

        foreach var $vars {
            if { $namelist($name,var=$var) ne {} } {
                append result [format "   %-*s = %s\n" $maxl $var $namelist($name,var=$var)]
            }           
        }

        # check if the namelist has an appix
        set affix {}
        if { [info exists card($name.affixCards)] } {
            set affix [string trimright [cardGetContent $name.affixCards]]            
        }
        if { $affix ne {} } {
            append result "\} \{\n$affix\n"
        }        

        return [append result "\}\n\n"]
    }
    return ""
}