TABLE OF CONTENTS
::pwtk::gp::term_ok
SYNOPSIS
proc ::pwtk::gp::term_ok {term} {
PURPOSE
Check if the terminal $term is OK.
This proc is typically used internally by PWTK.
RETURN VALUE
1 ... if the Gnuplot $term terminal is supported by PWTK and exists in Gnuplot 0 ... otherwise
SOURCE
variable gp if { [auto_execok gnuplot] eq {} } { ::pwtk::error "no usable Gnuplot program found" 1 } set term [pwtk2gp $term] # gp(supported_terminals) == list of terminals supported by both PWTK and Gnuplot ::pwtk::ifempty gp(supported_terminals) { set gp(terminals) [concat $gp(file.terminals) $gp(win.terminals) $gp(txt.terminals)] # add the empty terminal (i.e. Gnuplot's default terminal) to a # list of supported_terminals foreach type {"" file. win. txt.} { set gp(${type}supported_terminals) {} } # workaround: it happens that [::gp::gp print GPVAL_TERMINALS] may return an empty string for {set i 0} {$i < 10} {incr i} { if { [set gpterminals_ [::gp::gp print GPVAL_TERMINALS]] ne {} } { break } } foreach t $gpterminals_ { foreach type {"" file. win. txt.} { if { $t in $gp(${type}terminals) } { lappend gp(${type}supported_terminals) $t } } } } if { $term in $gp(win.terminals) \ && $::tcl_platform(platform) eq "unix" && ![info exists ::env(DISPLAY)] } { # win-terminal & no DISPLAY return 0 } if { $term in $gp(supported_terminals) } { return 1 } else { return 0 } }