TABLE OF CONTENTS


::pwtk::gp::expandOptions

SYNOPSIS

proc ::pwtk::gp::expandOptions {arr_set_list} {

PURPOSE

Convert PWTK's options, passed as input (i.e. $arr_set_list), to Gnuplot options snippet according to the order, defined in $known_options. The PWTK's predefined options are also added to the output snippet.

N.B. this routine is used only in pseudo.tcl

SOURCE

    variable known_options

    foreach name $known_options {
        pwtk::ifexist ::pwtk::gp::options($name) {
            set arr($name) $::pwtk::gp::options($name)
        }
    }

    # sort options according to $known_options

    set opts $known_options
    
    foreach {name value} $arr_set_list {
        if { $name ni $opts } {
            # new option: let's add it to the opts list
            lappend opts $name
        }
        set arr($name) $value
    }

    set options {}
    foreach elem $opts {
        ::pwtk::ifnotempty arr($elem) {
            # PWTK-->Gnuplot (e.g. format.x --> format x)
            set opt [split $elem .]
            append options "set $opt $arr($elem)\n"
        }
    }
    return $options\n
}