Changeset 1850 for trunk


Ignore:
Timestamp:
Jul 30, 2010 8:34:57 AM (14 years ago)
Author:
dkearney
Message:

adding perl wrapper example to configure and make scripts

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r1844 r1850  
    94909490
    94919491
    9492 ac_config_files="$ac_config_files Makefile packages/Makefile src/Makefile src/core/Makefile src/core2/Makefile src/objects/Makefile src/objects/RpHash.h gui/Makefile gui/apps/Makefile gui/apps/about gui/apps/encodedata gui/apps/rappture gui/apps/rappture-csh.env gui/apps/rappture.env gui/apps/rappture.use gui/apps/rerun gui/apps/simsim gui/apps/xmldiff gui/pkgIndex.tcl gui/scripts/Makefile instant/Makefile instant/irappture lang/Makefile lang/java/Makefile lang/java/rappture/Makefile lang/perl/Makefile lang/perl/Makefile.PL lang/python/Makefile lang/python/setup.py lang/matlab/Makefile lang/octave/Makefile lang/octave/octave2/Makefile lang/octave/octave3/Makefile lang/ruby/Makefile lang/ruby/build.rb lang/tcl/Makefile lang/tcl/pkgIndex.tcl lang/tcl/src/Makefile lang/tcl/scripts/Makefile lang/tcl/tests/Makefile lib/Makefile examples/3D/Makefile examples/Makefile examples/app-fermi/2.0/Makefile examples/app-fermi/Makefile examples/app-fermi/cee/Makefile examples/app-fermi/fortran/Makefile examples/app-fermi/java/Makefile examples/app-fermi/matlab/Makefile examples/app-fermi/matlab/compiled/Makefile examples/app-fermi/matlab/uncompiled/Makefile examples/app-fermi/octave/Makefile examples/app-fermi/octave/2/Makefile examples/app-fermi/octave/3/Makefile examples/app-fermi/perl/Makefile examples/app-fermi/python/Makefile examples/app-fermi/ruby/Makefile examples/app-fermi/tcl/Makefile examples/app-fermi/wrapper/Makefile examples/app-fermi/wrapper/cee/Makefile examples/app-fermi/wrapper/python/Makefile examples/app-fermi/wrapper/tcl/Makefile examples/c-example/Makefile examples/canvas/Makefile examples/demo.bash examples/flow/Makefile examples/flow/demo1/Makefile examples/flow/demo2/Makefile examples/flow/demo3/Makefile examples/graph/Makefile examples/objects/Makefile examples/objects/axis/Makefile examples/objects/contour/Makefile examples/objects/curve/Makefile examples/objects/dxWriter/Makefile examples/objects/floatBuffer/Makefile examples/objects/histogram/Makefile examples/objects/library/Makefile examples/objects/number/Makefile examples/objects/path/Makefile examples/objects/plot/Makefile examples/objects/scatter/Makefile examples/objects/string/Makefile examples/objects/tree/Makefile examples/objects/xmlparser/Makefile examples/zoo/Makefile examples/zoo/binary/Makefile examples/zoo/boolean/Makefile examples/zoo/choice/Makefile examples/zoo/cloud/Makefile examples/zoo/cloud/matlab/Makefile examples/zoo/curve/Makefile examples/zoo/enable/Makefile examples/zoo/field/Makefile examples/zoo/group/Makefile examples/zoo/image/Makefile examples/zoo/image/docs/Makefile examples/zoo/image/examples/Makefile examples/zoo/integer/Makefile examples/zoo/integer2/Makefile examples/zoo/loader/Makefile examples/zoo/loader/examples/Makefile examples/zoo/loadrun/Makefile examples/zoo/log/Makefile examples/zoo/note/Makefile examples/zoo/note/docs/Makefile examples/zoo/number/Makefile examples/zoo/number2/Makefile examples/zoo/periodicelement/Makefile examples/zoo/phase/Makefile examples/zoo/sequence/Makefile examples/zoo/sequence/examples/Makefile examples/zoo/string/Makefile examples/zoo/structure/Makefile examples/zoo/structure/examples/Makefile examples/zoo/table/Makefile examples/zoo/unirect2d/Makefile test/Makefile test/src/Makefile"
     9492ac_config_files="$ac_config_files Makefile packages/Makefile src/Makefile src/core/Makefile src/core2/Makefile src/objects/Makefile src/objects/RpHash.h gui/Makefile gui/apps/Makefile gui/apps/about gui/apps/encodedata gui/apps/rappture gui/apps/rappture-csh.env gui/apps/rappture.env gui/apps/rappture.use gui/apps/rerun gui/apps/simsim gui/apps/xmldiff gui/pkgIndex.tcl gui/scripts/Makefile instant/Makefile instant/irappture lang/Makefile lang/java/Makefile lang/java/rappture/Makefile lang/perl/Makefile lang/perl/Makefile.PL lang/python/Makefile lang/python/setup.py lang/matlab/Makefile lang/octave/Makefile lang/octave/octave2/Makefile lang/octave/octave3/Makefile lang/ruby/Makefile lang/ruby/build.rb lang/tcl/Makefile lang/tcl/pkgIndex.tcl lang/tcl/src/Makefile lang/tcl/scripts/Makefile lang/tcl/tests/Makefile lib/Makefile examples/3D/Makefile examples/Makefile examples/app-fermi/2.0/Makefile examples/app-fermi/Makefile examples/app-fermi/cee/Makefile examples/app-fermi/fortran/Makefile examples/app-fermi/java/Makefile examples/app-fermi/matlab/Makefile examples/app-fermi/matlab/compiled/Makefile examples/app-fermi/matlab/uncompiled/Makefile examples/app-fermi/octave/Makefile examples/app-fermi/octave/2/Makefile examples/app-fermi/octave/3/Makefile examples/app-fermi/perl/Makefile examples/app-fermi/python/Makefile examples/app-fermi/ruby/Makefile examples/app-fermi/tcl/Makefile examples/app-fermi/wrapper/Makefile examples/app-fermi/wrapper/cee/Makefile examples/app-fermi/wrapper/perl/Makefile examples/app-fermi/wrapper/python/Makefile examples/app-fermi/wrapper/tcl/Makefile examples/c-example/Makefile examples/canvas/Makefile examples/demo.bash examples/flow/Makefile examples/flow/demo1/Makefile examples/flow/demo2/Makefile examples/flow/demo3/Makefile examples/graph/Makefile examples/objects/Makefile examples/objects/axis/Makefile examples/objects/contour/Makefile examples/objects/curve/Makefile examples/objects/dxWriter/Makefile examples/objects/floatBuffer/Makefile examples/objects/histogram/Makefile examples/objects/library/Makefile examples/objects/number/Makefile examples/objects/path/Makefile examples/objects/plot/Makefile examples/objects/scatter/Makefile examples/objects/string/Makefile examples/objects/tree/Makefile examples/objects/xmlparser/Makefile examples/zoo/Makefile examples/zoo/binary/Makefile examples/zoo/boolean/Makefile examples/zoo/choice/Makefile examples/zoo/cloud/Makefile examples/zoo/cloud/matlab/Makefile examples/zoo/curve/Makefile examples/zoo/enable/Makefile examples/zoo/field/Makefile examples/zoo/group/Makefile examples/zoo/image/Makefile examples/zoo/image/docs/Makefile examples/zoo/image/examples/Makefile examples/zoo/integer/Makefile examples/zoo/integer2/Makefile examples/zoo/loader/Makefile examples/zoo/loader/examples/Makefile examples/zoo/loadrun/Makefile examples/zoo/log/Makefile examples/zoo/note/Makefile examples/zoo/note/docs/Makefile examples/zoo/number/Makefile examples/zoo/number2/Makefile examples/zoo/periodicelement/Makefile examples/zoo/phase/Makefile examples/zoo/sequence/Makefile examples/zoo/sequence/examples/Makefile examples/zoo/string/Makefile examples/zoo/structure/Makefile examples/zoo/structure/examples/Makefile examples/zoo/table/Makefile examples/zoo/unirect2d/Makefile test/Makefile test/src/Makefile"
    94939493
    94949494cat >confcache <<\_ACEOF
     
    1023910239    "examples/app-fermi/wrapper/Makefile") CONFIG_FILES="$CONFIG_FILES examples/app-fermi/wrapper/Makefile" ;;
    1024010240    "examples/app-fermi/wrapper/cee/Makefile") CONFIG_FILES="$CONFIG_FILES examples/app-fermi/wrapper/cee/Makefile" ;;
     10241    "examples/app-fermi/wrapper/perl/Makefile") CONFIG_FILES="$CONFIG_FILES examples/app-fermi/wrapper/perl/Makefile" ;;
    1024110242    "examples/app-fermi/wrapper/python/Makefile") CONFIG_FILES="$CONFIG_FILES examples/app-fermi/wrapper/python/Makefile" ;;
    1024210243    "examples/app-fermi/wrapper/tcl/Makefile") CONFIG_FILES="$CONFIG_FILES examples/app-fermi/wrapper/tcl/Makefile" ;;
  • trunk/configure.in

    r1844 r1850  
    722722    examples/app-fermi/wrapper/Makefile
    723723    examples/app-fermi/wrapper/cee/Makefile
     724    examples/app-fermi/wrapper/perl/Makefile
    724725    examples/app-fermi/wrapper/python/Makefile
    725726    examples/app-fermi/wrapper/tcl/Makefile
  • trunk/examples/app-fermi/wrapper/Makefile.in

    r1018 r1850  
    11
    22bindir          = @bindir@
    3 datadir         = @datadir@
    4 datarootdir     = @datarootdir@
     3datadir         = @datadir@
     4datarootdir     = @datarootdir@
    55exec_prefix     = @exec_prefix@
    66includedir      = @includedir@
     
    88mandir          = @mandir@
    99prefix          = @prefix@
    10 srcdir          = @srcdir@
     10srcdir          = @srcdir@
    1111
    12 INSTALL         = @INSTALL@
    13 VPATH           = $(srcdir)
    14 SHELL           = @SHELL@
    15 RM              = rm -f
     12INSTALL         = @INSTALL@
     13VPATH           = $(srcdir)
     14SHELL           = @SHELL@
     15RM              = rm -f
    1616
    17 .PHONY: cee python tcl
     17.PHONY: cee python tcl perl
    1818
    19 all:    python tcl cee
     19all:    python tcl cee perl
    2020
    2121cee:
    2222        $(MAKE) -C cee all
    23 python:
     23perl:
     24        $(MAKE) -C perl all
     25python:
    2426        $(MAKE) -C python all
    25 tcl: 
     27tcl:
    2628        $(MAKE) -C tcl all
     29
    2730
    2831install:
    2932        $(MAKE) -C cee install
     33        $(MAKE) -C perl install
    3034        $(MAKE) -C python install
    3135        $(MAKE) -C tcl install
     
    3337clean:
    3438        $(MAKE) -C cee clean
     39        $(MAKE) -C perl clean
    3540        $(MAKE) -C python clean
    3641        $(MAKE) -C tcl clean
    3742
    38 distclean: 
     43distclean:
    3944        $(MAKE) -C cee distclean
     45        $(MAKE) -C perl distclean
    4046        $(MAKE) -C python distclean
    4147        $(MAKE) -C tcl distclean
  • trunk/gui/scripts/editor.tcl

    r1342 r1850  
    5858    protected variable _loc   ;# array of editor location parameters
    5959}
    60                                                                                
     60                                                                               
    6161itk::usual Editor {
    6262    keep -cursor -font
     
    7474
    7575    itk_component add editor {
    76         entry $itk_interior.editor -highlightthickness 0
     76        entry $itk_interior.editor -highlightthickness 0
    7777    } {
    78         usual
    79         keep -relief
    80         ignore -highlightthickness
    81         ignore -highlightcolor
    82         ignore -highlightbackground
     78        usual
     79        keep -relief
     80        ignore -highlightthickness
     81        ignore -highlightcolor
     82        ignore -highlightbackground
    8383    }
    8484    pack $itk_component(editor) -expand yes -fill both
    8585
    8686    bind $itk_component(editor) <KeyPress> \
    87         [itcl::code $this _resize]
     87        [itcl::code $this _resize]
    8888    bind $itk_component(editor) <KeyPress-Return> \
    89         [itcl::code $this deactivate]
     89        [itcl::code $this deactivate]
    9090    bind $itk_component(editor) <KeyPress-Escape> \
    91         [itcl::code $this deactivate -abort]
     91        [itcl::code $this deactivate -abort]
    9292    bind $itk_component(editor) <ButtonPress> \
    93         [itcl::code $this _click %X %Y]
     93        [itcl::code $this _click %X %Y]
    9494
    9595    itk_component add emenu {
    96         menu $itk_component(editor).menu -tearoff 0
     96        menu $itk_component(editor).menu -tearoff 0
    9797    } {
    98         usual
    99         ignore -tearoff
    100         ignore -background -foreground
     98        usual
     99        ignore -tearoff
     100        ignore -background -foreground
    101101    }
    102102    $itk_component(emenu) add command -label "Cut" -accelerator "^X" \
    103         -command [list event generate $itk_component(editor) <<Cut>>]
     103        -command [list event generate $itk_component(editor) <<Cut>>]
    104104    $itk_component(emenu) add command -label "Copy" -accelerator "^C" \
    105         -command [list event generate $itk_component(editor) <<Copy>>]
     105        -command [list event generate $itk_component(editor) <<Copy>>]
    106106    $itk_component(emenu) add command -label "Paste" -accelerator "^V" \
    107         -command [list event generate $itk_component(editor) <<Paste>>]
     107        -command [list event generate $itk_component(editor) <<Paste>>]
    108108    bind $itk_component(editor) <<PopupMenu>> {
    109         tk_popup %W.menu %X %Y
     109        tk_popup %W.menu %X %Y
    110110    }
    111111
     
    124124    set e $itk_component(editor)
    125125    if {[winfo ismapped $e]} {
    126         return  ;# already mapped -- nothing to do
     126        return  ;# already mapped -- nothing to do
    127127    }
    128128
    129129    set info ""
    130130    if {[string length $itk_option(-activatecommand)] > 0} {
    131         set status [catch {uplevel #0 $itk_option(-activatecommand)} info]
    132         if {$status != 0} {
    133             bgerror $info
    134             return
    135         }
     131        set status [catch {uplevel #0 $itk_option(-activatecommand)} info]
     132        if {$status != 0} {
     133            bgerror $info
     134            return
     135        }
    136136    }
    137137
     
    145145    array set vals $info
    146146    if {![info exists vals(x)] || ![info exists vals(y)]} {
    147         return
     147        return
    148148    }
    149149    set _loc(x) $vals(x)
     
    154154    $itk_component(editor) delete 0 end
    155155    if {[info exists vals(text)]} {
    156         $itk_component(editor) insert end $vals(text)
     156        $itk_component(editor) insert end $vals(text)
    157157    }
    158158    $itk_component(editor) select from 0
     
    167167    update
    168168    while {[catch {grab set -global $itk_component(editor)}]} {
    169         after 100
     169        after 100
    170170    }
    171171}
     
    188188
    189189    if {$args == "-abort"} {
    190         grab release $itk_component(editor)
    191         wm withdraw $itk_component(hull)
    192         return
     190        grab release $itk_component(editor)
     191        wm withdraw $itk_component(hull)
     192        return
    193193    }
    194194
     
    200200    #
    201201    if {[string length $itk_option(-validatecommand)] > 0} {
    202         set cmd "uplevel #0 [list $itk_option(-validatecommand) [list $str]]"
    203         if {[catch $cmd result]} {
    204             bgerror $result
    205             set result 1
    206         }
    207         if {$result == 0} {
    208             bell
    209             $itk_component(editor) select from 0
    210             $itk_component(editor) select to end
    211             $itk_component(editor) icursor end
    212             focus $itk_component(editor)
    213             return
    214         }
     202        set cmd "uplevel #0 [list $itk_option(-validatecommand) [list $str]]"
     203        if {[catch $cmd result]} {
     204            bgerror $result
     205            set result 1
     206        }
     207        if {$result == 0} {
     208            bell
     209            $itk_component(editor) select from 0
     210            $itk_component(editor) select to end
     211            $itk_component(editor) icursor end
     212            focus $itk_component(editor)
     213            return
     214        }
    215215    }
    216216
     
    223223    #
    224224    if {[string length $itk_option(-applycommand)] > 0} {
    225         set cmd "uplevel #0 [list $itk_option(-applycommand) [list $str]]"
    226         if {[catch $cmd result]} {
    227             bgerror $result
    228             return
    229         }
     225        set cmd "uplevel #0 [list $itk_option(-applycommand) [list $str]]"
     226        if {[catch $cmd result]} {
     227            bgerror $result
     228            return
     229        }
    230230    }
    231231}
     
    255255itcl::body Rappture::Editor::_click {x y} {
    256256    if {[winfo containing $x $y] != $itk_component(editor)} {
    257         deactivate
     257        deactivate
    258258    } else {
    259         # make sure the editor has keyboard focus!
    260         # it loses focus sometimes during cut/copy/paste operations
    261         focus -force $itk_component(editor)
     259        # make sure the editor has keyboard focus!
     260        # it loses focus sometimes during cut/copy/paste operations
     261        focus -force $itk_component(editor)
    262262    }
    263263}
     
    278278    set w [expr {($w < $_loc(w)) ? $_loc(w) : $w}]
    279279    if {$w+$_loc(x) >= [winfo screenwidth $e]} {
    280         set w [expr {[winfo screenwidth $e]-$_loc(x)}]
     280        set w [expr {[winfo screenwidth $e]-$_loc(x)}]
    281281    }
    282282
     
    284284    set h [expr {($h < $_loc(h)) ? $_loc(h) : $h}]
    285285    if {$h+$_loc(y) >= [winfo screenheight $e]} {
    286         set h [expr {[winfo screenheight $e]-$_loc(y)}]
    287     }                                   
     286        set h [expr {[winfo screenheight $e]-$_loc(y)}]
     287    }                                       
    288288    # Temporary fix to prevent Opps. Don't deal with negative dimensions.
    289289    if { $w <= 0 || $h <= 0 } {
    290         wm geometry $itk_component(hull) "+$_loc(x)+$_loc(y)"
     290        wm geometry $itk_component(hull) "+$_loc(x)+$_loc(y)"
    291291    } else {
    292         wm geometry $itk_component(hull) "${w}x${h}+$_loc(x)+$_loc(y)"
     292        wm geometry $itk_component(hull) "${w}x${h}+$_loc(x)+$_loc(y)"
    293293    }
    294294}
  • trunk/gui/scripts/gauge.tcl

    r1483 r1850  
    5555
    5656    blt::bitmap define GaugeArrow-up {
    57         #define up_width 8
    58         #define up_height 4
    59         static unsigned char up_bits[] = {
    60            0x10, 0x38, 0x7c, 0xfe};
     57        #define up_width 8
     58        #define up_height 4
     59        static unsigned char up_bits[] = {
     60           0x10, 0x38, 0x7c, 0xfe};
    6161    }
    6262    blt::bitmap define GaugeArrow-down {
    63         #define arrow_width 8
    64         #define arrow_height 4
    65         static unsigned char arrow_bits[] = {
    66            0xfe, 0x7c, 0x38, 0x10};
     63        #define arrow_width 8
     64        #define arrow_height 4
     65        static unsigned char arrow_bits[] = {
     66           0xfe, 0x7c, 0x38, 0x10};
    6767    }
    6868
    6969    blt::bitmap define GaugeArrow {
    70         #define arrow_width 9
    71         #define arrow_height 4
    72         static unsigned char arrow_bits[] = {
    73            0x7f, 0x00, 0x3e, 0x00, 0x1c, 0x00, 0x08, 0x00};
    74     }
    75 }
    76                                                                                
     70        #define arrow_width 9
     71        #define arrow_height 4
     72        static unsigned char arrow_bits[] = {
     73           0x7f, 0x00, 0x3e, 0x00, 0x1c, 0x00, 0x08, 0x00};
     74    }
     75}
     76                                                                               
    7777itk::usual Gauge {
    7878    keep -cursor -font -foreground -background
     
    8585itcl::body Rappture::Gauge::constructor {args} {
    8686    itk_component add icon {
    87         canvas $itk_interior.icon -width 1 -height 1 \
    88             -borderwidth 0 -highlightthickness 0
     87        canvas $itk_interior.icon -width 1 -height 1 \
     88            -borderwidth 0 -highlightthickness 0
    8989    } {
    90         usual
    91         ignore -highlightthickness -highlightbackground -highlightcolor
     90        usual
     91        ignore -highlightthickness -highlightbackground -highlightcolor
    9292    }
    9393    pack $itk_component(icon) -side left
     
    9595
    9696    itk_component add -protected vframe {
    97         frame $itk_interior.vframe
     97        frame $itk_interior.vframe
    9898    }
    9999
    100100    itk_component add value {
    101         label $itk_component(vframe).value -borderwidth 1 -width 7 \
    102             -textvariable [itcl::scope _value]
     101        label $itk_component(vframe).value -borderwidth 1 -width 7 \
     102            -textvariable [itcl::scope _value]
    103103    } {
    104         rename -background -textbackground textBackground Background
     104        rename -background -textbackground textBackground Background
    105105    }
    106106    pack $itk_component(value) -side left -expand yes -fill both
     
    114114
    115115    itk_component add emenu {
    116         menu $itk_component(value).menu -tearoff 0
     116        menu $itk_component(value).menu -tearoff 0
    117117    } {
    118         usual
    119         ignore -tearoff
     118        usual
     119        ignore -tearoff
    120120    }
    121121    $itk_component(emenu) add command -label "Cut" -accelerator "^X" \
    122         -command [list event generate $itk_component(value) <<Cut>>]
     122        -command [list event generate $itk_component(value) <<Cut>>]
    123123    $itk_component(emenu) add command -label "Copy" -accelerator "^C" \
    124         -command [list event generate $itk_component(value) <<Copy>>]
     124        -command [list event generate $itk_component(value) <<Copy>>]
    125125    $itk_component(emenu) add command -label "Paste" -accelerator "^V" \
    126         -command [list event generate $itk_component(value) <<Paste>>]
     126        -command [list event generate $itk_component(value) <<Paste>>]
    127127    bind $itk_component(value) <<PopupMenu>> \
    128         [itcl::code $this _editor menu %X %Y]
     128        [itcl::code $this _editor menu %X %Y]
    129129
    130130    itk_component add editor {
    131         Rappture::Editor $itk_interior.editor \
    132             -activatecommand [itcl::code $this _editor activate] \
    133             -validatecommand [itcl::code $this _editor validate] \
    134             -applycommand [itcl::code $this _editor apply]
     131        Rappture::Editor $itk_interior.editor \
     132            -activatecommand [itcl::code $this _editor activate] \
     133            -validatecommand [itcl::code $this _editor validate] \
     134            -applycommand [itcl::code $this _editor apply]
    135135    }
    136136    bind $itk_component(value) <ButtonPress> \
    137         [itcl::code $this _editor popup]
     137        [itcl::code $this _editor popup]
    138138
    139139
    140140    itk_component add spinner {
    141         frame $itk_component(vframe).spinner
     141        frame $itk_component(vframe).spinner
    142142    }
    143143
    144144    itk_component add spinup {
    145         button $itk_component(spinner).up -bitmap GaugeArrow-up \
    146             -borderwidth 1 -relief raised -highlightthickness 0 \
    147             -command [itcl::code $this bump 1]
     145        button $itk_component(spinner).up -bitmap GaugeArrow-up \
     146            -borderwidth 1 -relief raised -highlightthickness 0 \
     147            -command [itcl::code $this bump 1]
    148148    } {
    149         usual
    150         ignore -borderwidth -highlightthickness
     149        usual
     150        ignore -borderwidth -highlightthickness
    151151    }
    152152    pack $itk_component(spinup) -side top -expand yes -fill both
    153153
    154154    itk_component add spindn {
    155         button $itk_component(spinner).down -bitmap GaugeArrow-down \
    156             -borderwidth 1 -relief raised -highlightthickness 0 \
    157             -command [itcl::code $this bump -1]
     155        button $itk_component(spinner).down -bitmap GaugeArrow-down \
     156            -borderwidth 1 -relief raised -highlightthickness 0 \
     157            -command [itcl::code $this bump -1]
    158158    } {
    159         usual
    160         ignore -borderwidth -highlightthickness
     159        usual
     160        ignore -borderwidth -highlightthickness
    161161    }
    162162    pack $itk_component(spindn) -side bottom -expand yes -fill both
     
    164164
    165165    itk_component add presets {
    166         button $itk_component(vframe).psbtn -bitmap GaugeArrow \
    167             -borderwidth 1 -highlightthickness 0 -relief flat
     166        button $itk_component(vframe).psbtn -bitmap GaugeArrow \
     167            -borderwidth 1 -highlightthickness 0 -relief flat
    168168    } {
    169         usual
    170         ignore -borderwidth -relief -highlightthickness
    171         rename -background -textbackground textBackground Background
     169        usual
     170        ignore -borderwidth -relief -highlightthickness
     171        rename -background -textbackground textBackground Background
    172172    }
    173173
     
    176176
    177177    itk_component add presetlist {
    178         Rappture::Dropdownlist $itk_component(presets).plist \
    179             -postcommand [itcl::code $this _presets post] \
    180             -unpostcommand [itcl::code $this _presets unpost] \
     178        Rappture::Dropdownlist $itk_component(presets).plist \
     179            -postcommand [itcl::code $this _presets post] \
     180            -unpostcommand [itcl::code $this _presets unpost] \
    181181    }
    182182
    183183    bind $itk_component(presetlist) <<DropdownlistSelect>> \
    184         [itcl::code $this _presets select]
     184        [itcl::code $this _presets select]
    185185
    186186    $itk_component(presets) configure -command \
    187         [list $itk_component(presetlist) post $itk_component(vframe) left]
     187        [list $itk_component(presetlist) post $itk_component(vframe) left]
    188188
    189189    eval itk_initialize $args
     
    203203    set i [lsearch -exact $args -check]
    204204    if {$i >= 0} {
    205         set onlycheck 1
    206         set args [lreplace $args $i $i]
     205        set onlycheck 1
     206        set args [lreplace $args $i $i]
    207207    }
    208208
    209209    if {[llength $args] == 1} {
    210         #
    211         # If this gauge has -units, try to convert the incoming
    212         # value to that system of units.  Also, make sure that
    213         # the value is bound by any min/max value constraints.
    214         #
    215         # Keep track of the inputted units so we can give a
    216         # response about min and max values in familiar units.
    217         #
    218         set newval [set nv [lindex $args 0]]
    219         set units $itk_option(-units)
    220         if {"" != $units} {
    221             set newval [Rappture::Units::convert $newval -context $units]
    222             set nvUnits [Rappture::Units::Search::for $newval]
    223             if { "" == $nvUnits} {
    224                 set msg [Rappture::Units::description $units]
    225                 error "Unrecognized units: $newval\nEnter value with units of $msg"
    226             }
    227             set nv [Rappture::Units::convert $nv \
    228                 -context $units -to $units -units off]
    229 
    230             # Normalize the units name
    231             set newval [Rappture::Units::convert $newval -units off]$nvUnits
    232         }
    233 
    234         switch -- $itk_option(-type) {
    235             integer {
    236                 if { [scan $nv "%g" value] != 1 || int($nv) != $value } {
    237                     error "bad value \"$nv\": should be an integer value"
    238                 }
    239             }
    240             real {
    241                 if {[string length $nv] <= 0
    242                       || ![string is double $nv]
    243                       || [regexp -nocase {^(inf|nan)$} $nv]} {
    244                     error "bad value \"$nv\": should be a real number"
    245                 }
    246             }
    247         }
    248 
    249         if {"" != $itk_option(-minvalue)} {
    250             set convMinVal [set minv $itk_option(-minvalue)]
    251             if {"" != $units} {
    252                 set minv [Rappture::Units::convert $minv \
    253                     -context $units -to $units -units off]
    254                 set convMinVal [Rappture::Units::convert \
    255                     $itk_option(-minvalue) -context $units -to $nvUnits]
    256             } else {
    257                 set newval [format "%g" $newval]
    258             }
    259 
    260             # fix for the case when the user tries to
    261             # compare values like minv=-500 nv=-0600
    262             set nv [format "%g" $nv]
    263             set minv [format "%g" $minv]
    264 
    265             if {$nv < $minv} {
    266                 error "minimum value allowed here is $convMinVal"
    267             }
    268         }
    269 
    270         if {"" != $itk_option(-maxvalue)} {
    271             set convMaxVal [set maxv $itk_option(-maxvalue)]
    272             if {"" != $units} {
    273                 set maxv [Rappture::Units::convert $maxv \
    274                     -context $units -to $units -units off]
    275                 set convMaxVal [Rappture::Units::convert \
    276                     $itk_option(-maxvalue) -context $units -to $nvUnits]
    277             } else {
    278                 set newval [format "%g" $newval]
    279             }
    280 
    281             # fix for the case when the user tries to
    282             # compare values like maxv=500 nv=0600
    283             set nv [format "%g" $nv]
    284             set maxv [format "%g" $maxv]
    285 
    286             if {$nv > $maxv} {
    287                 error "maximum value allowed here is $convMaxVal"
    288             }
    289         }
    290 
    291         if {$onlycheck} {
    292             return
    293         }
    294 
    295         set _value $newval
    296 
    297         _redraw
    298         event generate $itk_component(hull) <<Value>>
     210        #
     211        # If this gauge has -units, try to convert the incoming
     212        # value to that system of units.  Also, make sure that
     213        # the value is bound by any min/max value constraints.
     214        #
     215        # Keep track of the inputted units so we can give a
     216        # response about min and max values in familiar units.
     217        #
     218        set newval [set nv [lindex $args 0]]
     219        set units $itk_option(-units)
     220        if {"" != $units} {
     221            set newval [Rappture::Units::convert $newval -context $units]
     222            set nvUnits [Rappture::Units::Search::for $newval]
     223            if { "" == $nvUnits} {
     224                set msg [Rappture::Units::description $units]
     225                error "Unrecognized units: $newval\nEnter value with units of $msg"
     226            }
     227            set nv [Rappture::Units::convert $nv \
     228                -context $units -to $units -units off]
     229
     230            # Normalize the units name
     231            set newval [Rappture::Units::convert $newval -units off]$nvUnits
     232        }
     233
     234        switch -- $itk_option(-type) {
     235            integer {
     236                if { [scan $nv "%g" value] != 1 || int($nv) != $value } {
     237                    error "bad value \"$nv\": should be an integer value"
     238                }
     239            }
     240            real {
     241                if {[string length $nv] <= 0
     242                      || ![string is double $nv]
     243                      || [regexp -nocase {^(inf|nan)$} $nv]} {
     244                    error "bad value \"$nv\": should be a real number"
     245                }
     246            }
     247        }
     248
     249        if {"" != $itk_option(-minvalue)} {
     250            set convMinVal [set minv $itk_option(-minvalue)]
     251            if {"" != $units} {
     252                set minv [Rappture::Units::convert $minv \
     253                    -context $units -to $units -units off]
     254                set convMinVal [Rappture::Units::convert \
     255                    $itk_option(-minvalue) -context $units -to $nvUnits]
     256            } else {
     257                set newval [format "%g" $newval]
     258            }
     259
     260            # fix for the case when the user tries to
     261            # compare values like minv=-500 nv=-0600
     262            set nv [format "%g" $nv]
     263            set minv [format "%g" $minv]
     264
     265            if {$nv < $minv} {
     266                error "minimum value allowed here is $convMinVal"
     267            }
     268        }
     269
     270        if {"" != $itk_option(-maxvalue)} {
     271            set convMaxVal [set maxv $itk_option(-maxvalue)]
     272            if {"" != $units} {
     273                set maxv [Rappture::Units::convert $maxv \
     274                    -context $units -to $units -units off]
     275                set convMaxVal [Rappture::Units::convert \
     276                    $itk_option(-maxvalue) -context $units -to $nvUnits]
     277            } else {
     278                set newval [format "%g" $newval]
     279            }
     280
     281            # fix for the case when the user tries to
     282            # compare values like maxv=500 nv=0600
     283            set nv [format "%g" $nv]
     284            set maxv [format "%g" $maxv]
     285
     286            if {$nv > $maxv} {
     287                error "maximum value allowed here is $convMaxVal"
     288            }
     289        }
     290
     291        if {$onlycheck} {
     292            return
     293        }
     294
     295        set _value $newval
     296
     297        _redraw
     298        event generate $itk_component(hull) <<Value>>
    299299
    300300    } elseif {[llength $args] != 0} {
    301         error "wrong # args: should be \"value ?-check? ?newval?\""
     301        error "wrong # args: should be \"value ?-check? ?newval?\""
    302302    }
    303303    return $_value
     
    315315itcl::body Rappture::Gauge::edit {option} {
    316316    if {$itk_option(-state) == "disabled"} {
    317         return  ;# disabled? then bail out here!
     317        return  ;# disabled? then bail out here!
    318318    }
    319319    switch -- $option {
    320         cut {
    321             edit copy
    322             _editor popup
    323             $itk_component(editor) value ""
    324             $itk_component(editor) deactivate
    325         }
    326         copy {
    327             clipboard clear
    328             clipboard append $_value
    329         }
    330         paste {
    331             _editor popup
    332             $itk_component(editor) value [clipboard get]
    333             $itk_component(editor) deactivate
    334         }
    335         default {
    336             error "bad option \"$option\": should be cut, copy, paste"
    337         }
     320        cut {
     321            edit copy
     322            _editor popup
     323            $itk_component(editor) value ""
     324            $itk_component(editor) deactivate
     325        }
     326        copy {
     327            clipboard clear
     328            clipboard append $_value
     329        }
     330        paste {
     331            _editor popup
     332            $itk_component(editor) value [clipboard get]
     333            $itk_component(editor) deactivate
     334        }
     335        default {
     336            error "bad option \"$option\": should be cut, copy, paste"
     337        }
    338338    }
    339339}
     
    349349    set val $_value
    350350    if {$val == ""} {
    351         set val 0
     351        set val 0
    352352    }
    353353    if {[catch {value [expr {$val+$delta}]} result]} {
    354         if {[regexp {allowed here is (.+)} $result match newval]} {
    355             set _value $newval
    356             $itk_component(value) configure -text $newval
    357         }
    358         if {[regexp {^bad.*: +(.)(.+)} $result match first tail]
    359               || [regexp {(.)(.+)} $result match first tail]} {
    360             set result "[string toupper $first]$tail"
    361         }
    362         bell
    363         Rappture::Tooltip::cue $itk_component(value) $result
    364         return 0
     354        if {[regexp {allowed here is (.+)} $result match newval]} {
     355            set _value $newval
     356            $itk_component(value) configure -text $newval
     357        }
     358        if {[regexp {^bad.*: +(.)(.+)} $result match first tail]
     359              || [regexp {(.)(.+)} $result match first tail]} {
     360            set result "[string toupper $first]$tail"
     361        }
     362        bell
     363        Rappture::Tooltip::cue $itk_component(value) $result
     364        return 0
    365365    }
    366366}
     
    380380
    381381    if {"" == [$c find all]} {
    382         # first time around, create the items
    383         $c create rectangle 0 0 1 1 -outline black -tags block
    384         $c create image 0 0 -anchor center -image "" -tags bimage
    385         $c create rectangle 0 0 1 1 -outline "" -fill "" -stipple gray50 -tags screen
     382        # first time around, create the items
     383        $c create rectangle 0 0 1 1 -outline black -tags block
     384        $c create image 0 0 -anchor center -image "" -tags bimage
     385        $c create rectangle 0 0 1 1 -outline "" -fill "" -stipple gray50 -tags screen
    386386    }
    387387
    388388    if {"" != $itk_option(-spectrum)} {
    389         set color [$itk_option(-spectrum) get $_value]
     389        set color [$itk_option(-spectrum) get $_value]
    390390    } else {
    391         set color ""
     391        set color ""
    392392    }
    393393
     
    400400
    401401    if {$itk_option(-state) == "disabled"} {
    402         $c itemconfigure screen -fill white
     402        $c itemconfigure screen -fill white
    403403    } else {
    404         $c itemconfigure screen -fill ""
     404        $c itemconfigure screen -fill ""
    405405    }
    406406}
     
    417417
    418418    if {"" != $itk_option(-image) || "" != $itk_option(-spectrum)} {
    419         if {$itk_option(-samplewidth) > 0} {
    420             set w $itk_option(-samplewidth)
    421         } else {
    422             if {$itk_option(-image) != ""} {
    423                 set w [expr {[image width $itk_option(-image)]+4}]
    424             } else {
    425                 set w [winfo reqheight $itk_component(value)]
    426             }
    427         }
    428 
    429         if {$itk_option(-sampleheight) > 0} {
    430             set h $itk_option(-sampleheight)
    431         } else {
    432             if {$itk_option(-image) != ""} {
    433                 set h [expr {[image height $itk_option(-image)]+4}]
    434             } else {
    435                 set h [winfo reqheight $itk_component(value)]
    436             }
    437         }
     419        if {$itk_option(-samplewidth) > 0} {
     420            set w $itk_option(-samplewidth)
     421        } else {
     422            if {$itk_option(-image) != ""} {
     423                set w [expr {[image width $itk_option(-image)]+4}]
     424            } else {
     425                set w [winfo reqheight $itk_component(value)]
     426            }
     427        }
     428
     429        if {$itk_option(-sampleheight) > 0} {
     430            set h $itk_option(-sampleheight)
     431        } else {
     432            if {$itk_option(-image) != ""} {
     433                set h [expr {[image height $itk_option(-image)]+4}]
     434            } else {
     435                set h [winfo reqheight $itk_component(value)]
     436            }
     437        }
    438438    }
    439439
    440440    if {$w > 0 && $h > 0} {
    441         $itk_component(icon) configure -width $w -height $h
     441        $itk_component(icon) configure -width $w -height $h
    442442    }
    443443}
     
    451451itcl::body Rappture::Gauge::_hilite {comp state} {
    452452    if {$itk_option(-state) == "disabled"} {
    453         set state 0  ;# disabled? then don't hilite
     453        set state 0  ;# disabled? then don't hilite
    454454    }
    455455    if {$comp == "value" && !$itk_option(-editable)} {
    456         $itk_component(value) configure -relief flat
    457         return
     456        $itk_component(value) configure -relief flat
     457        return
    458458    }
    459459
    460460    if {$state} {
    461         $itk_component($comp) configure -relief solid
     461        $itk_component($comp) configure -relief solid
    462462    } else {
    463         $itk_component($comp) configure -relief flat
     463        $itk_component($comp) configure -relief flat
    464464    }
    465465}
     
    477477itcl::body Rappture::Gauge::_editor {option args} {
    478478    if {$itk_option(-state) == "disabled"} {
    479         return  ;# disabled? then bail out here!
     479        return  ;# disabled? then bail out here!
    480480    }
    481481    switch -- $option {
    482         popup {
    483             if {$itk_option(-editable)} {
    484                 $itk_component(editor) activate
    485             }
    486         }
    487         activate {
    488             return [list text $_value \
    489                 x [winfo rootx $itk_component(value)] \
    490                 y [winfo rooty $itk_component(value)] \
    491                 w [winfo width $itk_component(value)] \
    492                 h [winfo height $itk_component(value)]]
    493         }
    494         validate {
    495             if {[llength $args] != 1} {
    496                 error "wrong # args: should be \"_editor validate val\""
    497             }
    498             set val [lindex $args 0]
    499 
    500             if {[catch {value -check $val} result]} {
    501                 if {[regexp {allowed here is (.+)} $result match newval]} {
    502                     $itk_component(editor) value $newval
    503                 }
    504                 if {[regexp {^bad.*: +(.)(.+)} $result match first tail]
    505                       || [regexp {(.)(.+)} $result match first tail]} {
    506                     set result "[string toupper $first]$tail"
    507                 }
    508                 bell
    509                 Rappture::Tooltip::cue $itk_component(editor) $result
    510                 return 0
    511             }
    512         }
    513         apply {
    514             if {[llength $args] != 1} {
    515                 error "wrong # args: should be \"_editor apply val\""
    516             }
    517             value [lindex $args 0]
    518         }
    519         menu {
    520             eval tk_popup $itk_component(emenu) $args
    521         }
    522         default {
    523             error "bad option \"$option\": should be popup, activate, validate, apply, and menu"
    524         }
     482        popup {
     483            if {$itk_option(-editable)} {
     484                $itk_component(editor) activate
     485            }
     486        }
     487        activate {
     488            return [list text $_value \
     489                x [winfo rootx $itk_component(value)] \
     490                y [winfo rooty $itk_component(value)] \
     491                w [winfo width $itk_component(value)] \
     492                h [winfo height $itk_component(value)]]
     493        }
     494        validate {
     495            if {[llength $args] != 1} {
     496                error "wrong # args: should be \"_editor validate val\""
     497            }
     498            set val [lindex $args 0]
     499
     500            if {[catch {value -check $val} result]} {
     501                if {[regexp {allowed here is (.+)} $result match newval]} {
     502                    $itk_component(editor) value $newval
     503                }
     504                if {[regexp {^bad.*: +(.)(.+)} $result match first tail]
     505                      || [regexp {(.)(.+)} $result match first tail]} {
     506                    set result "[string toupper $first]$tail"
     507                }
     508                bell
     509                Rappture::Tooltip::cue $itk_component(editor) $result
     510                return 0
     511            }
     512        }
     513        apply {
     514            if {[llength $args] != 1} {
     515                error "wrong # args: should be \"_editor apply val\""
     516            }
     517            value [lindex $args 0]
     518        }
     519        menu {
     520            eval tk_popup $itk_component(emenu) $args
     521        }
     522        default {
     523            error "bad option \"$option\": should be popup, activate, validate, apply, and menu"
     524        }
    525525    }
    526526}
     
    539539itcl::body Rappture::Gauge::_presets {option} {
    540540    switch -- $option {
    541         post {
    542             set i [$itk_component(presetlist) index $_value]
    543             if {$i >= 0} {
    544                 $itk_component(presetlist) select clear 0 end
    545                 $itk_component(presetlist) select set $i
    546             }
    547             after 10 [list $itk_component(presets) configure -relief sunken]
    548         }
    549         unpost {
    550             $itk_component(presets) configure -relief flat
    551         }
    552         select {
    553             set val [$itk_component(presetlist) current]
    554             if {"" != $val} {
    555                 value $val
    556             }
    557         }
    558         default {
    559             error "bad option \"$option\": should be post, unpost, select"
    560         }
     541        post {
     542            set i [$itk_component(presetlist) index $_value]
     543            if {$i >= 0} {
     544                $itk_component(presetlist) select clear 0 end
     545                $itk_component(presetlist) select set $i
     546            }
     547            after 10 [list $itk_component(presets) configure -relief sunken]
     548        }
     549        unpost {
     550            $itk_component(presets) configure -relief flat
     551        }
     552        select {
     553            set val [$itk_component(presetlist) current]
     554            if {"" != $val} {
     555                value $val
     556            }
     557        }
     558        default {
     559            error "bad option \"$option\": should be post, unpost, select"
     560        }
    561561    }
    562562}
     
    572572itcl::body Rappture::Gauge::_layout {} {
    573573    foreach w [pack slaves $itk_component(hull)] {
    574         pack forget $w
     574        pack forget $w
    575575    }
    576576
    577577    array set side2anchor {
    578         left   e
    579         right  w
    580         top    s
    581         bottom n
     578        left   e
     579        right  w
     580        top    s
     581        bottom n
    582582    }
    583583    set pos $itk_option(-valueposition)
    584584    pack $itk_component(vframe) -side $pos \
    585         -expand yes -fill both -ipadx 2
     585        -expand yes -fill both -ipadx 2
    586586    $itk_component(value) configure -anchor $side2anchor($pos)
    587587
    588588    if {"" != $itk_option(-image) || "" != $itk_option(-spectrum)} {
    589         pack $itk_component(icon) -side $pos
     589        pack $itk_component(icon) -side $pos
    590590    }
    591591}
     
    596596itcl::configbody Rappture::Gauge::editable {
    597597    if {![string is boolean -strict $itk_option(-editable)]} {
    598         error "bad value \"$itk_option(-editable)\": should be boolean"
     598        error "bad value \"$itk_option(-editable)\": should be boolean"
    599599    }
    600600    if {!$itk_option(-editable) && [winfo ismapped $itk_component(editor)]} {
    601         $itk_component(editor) deactivate -abort
     601        $itk_component(editor) deactivate -abort
    602602    }
    603603}
     
    609609    set valid {normal disabled}
    610610    if {[lsearch -exact $valid $itk_option(-state)] < 0} {
    611         error "bad value \"$itk_option(-state)\": should be [join $valid {, }]"
     611        error "bad value \"$itk_option(-state)\": should be [join $valid {, }]"
    612612    }
    613613    $itk_component(value) configure -state $itk_option(-state)
     
    623623itcl::configbody Rappture::Gauge::spectrum {
    624624    if {$itk_option(-spectrum) != ""
    625           && ([catch {$itk_option(-spectrum) isa ::Rappture::Spectrum} valid]
    626                || !$valid)} {
    627         error "bad option \"$itk_option(-spectrum)\": should be Rappture::Spectrum object"
     625          && ([catch {$itk_option(-spectrum) isa ::Rappture::Spectrum} valid]
     626               || !$valid)} {
     627        error "bad option \"$itk_option(-spectrum)\": should be Rappture::Spectrum object"
    628628    }
    629629    _resize
     
    637637itcl::configbody Rappture::Gauge::image {
    638638    if {$itk_option(-image) != ""
    639           && [catch {image width $itk_option(-image)}]} {
    640         error "bad value \"$itk_option(-image)\": should be Tk image"
     639          && [catch {image width $itk_option(-image)}]} {
     640        error "bad value \"$itk_option(-image)\": should be Tk image"
    641641    }
    642642    _resize
     
    650650itcl::configbody Rappture::Gauge::units {
    651651    if {$itk_option(-units) != ""
    652           && [::Rappture::Units::System::for $itk_option(-units)] == ""} {
    653         error "unrecognized system of units \"$itk_option(-units)\""
     652          && [::Rappture::Units::System::for $itk_option(-units)] == ""} {
     653        error "unrecognized system of units \"$itk_option(-units)\""
    654654    }
    655655}
     
    662662    set opts {left right top bottom}
    663663    if {[lsearch -exact $opts $pos] < 0} {
    664         error "bad value \"$pos\": should be [join $opts {, }]"
     664        error "bad value \"$pos\": should be [join $opts {, }]"
    665665    }
    666666    _layout
     
    672672itcl::configbody Rappture::Gauge::presets {
    673673    if {"" == $itk_option(-presets)} {
    674         pack forget $itk_component(presets)
     674        pack forget $itk_component(presets)
    675675    } else {
    676         if {$itk_option(-valueposition) == "left"} {
    677             set s "left"
    678         } else {
    679             set s "right"
    680         }
    681         set first [lindex [pack slaves $itk_component(vframe)] 0]
    682         pack $itk_component(presets) -before $first -side $s -fill y
    683 
    684         $itk_component(presetlist) delete 0 end
    685         $itk_component(presetlist) insert end $itk_option(-presets)
     676        if {$itk_option(-valueposition) == "left"} {
     677            set s "left"
     678        } else {
     679            set s "right"
     680        }
     681        set first [lindex [pack slaves $itk_component(vframe)] 0]
     682        pack $itk_component(presets) -before $first -side $s -fill y
     683
     684        $itk_component(presetlist) delete 0 end
     685        $itk_component(presetlist) insert end $itk_option(-presets)
    686686    }
    687687}
     
    692692itcl::configbody Rappture::Gauge::type {
    693693    switch -- $itk_option(-type) {
    694         integer {
    695             set first [lindex [pack slaves $itk_component(vframe)] 0]
    696             if {$first == $itk_component(presets)} {
    697                 pack $itk_component(spinner) -after $first -side left -fill y
    698             } else {
    699                 pack $itk_component(spinner) -before $first -side right -fill y
    700             }
    701         }
    702         real {
    703             pack forget $itk_component(spinner)
    704         }
    705         default {
    706             error "bad number type \"$itk_option(-type)\": should be integer or real"
    707         }
    708     }
    709 }
     694        integer {
     695            set first [lindex [pack slaves $itk_component(vframe)] 0]
     696            if {$first == $itk_component(presets)} {
     697                pack $itk_component(spinner) -after $first -side left -fill y
     698            } else {
     699                pack $itk_component(spinner) -before $first -side right -fill y
     700            }
     701        }
     702        real {
     703            pack forget $itk_component(spinner)
     704        }
     705        default {
     706            error "bad number type \"$itk_option(-type)\": should be integer or real"
     707        }
     708    }
     709}
  • trunk/lang/tcl/src/RpEncodeTclInterface.cc

    r1409 r1850  
    8181        string = (Rappture::encoding::isBinary(buf, bufLen)) ? "yes" : "no";
    8282    } else if (('e' == *type) && (strcmp(type,"encoded") == 0)) {
    83         bool isEncoded;
     83        bool isEncoded;
    8484
    8585        isEncoded = (Rappture::encoding::headerFlags(buf, bufLen) != 0);
    86         string = (isEncoded) ? "yes" : "no" ;
     86        string = (isEncoded) ? "yes" : "no" ;
    8787    } else {
    88         Tcl_AppendResult(interp, "bad option \"", type,
    89                 "\": should be binary or encoded", (char*)NULL);
    90         return TCL_ERROR;
     88        Tcl_AppendResult(interp, "bad option \"", type,
     89                "\": should be binary or encoded", (char*)NULL);
     90        return TCL_ERROR;
    9191    }
    9292    Tcl_SetResult(interp, (char *)string, TCL_STATIC);
     
    114114 * AsSwitch --
    115115 *
    116  *      Convert a string represent a node number into its integer
    117  *      value.
     116 *        Convert a string represent a node number into its integer
     117 *        value.
    118118 *
    119119 * Results:
    120  *      The return value is a standard Tcl result.
     120 *        The return value is a standard Tcl result.
    121121 *
    122122 *---------------------------------------------------------------------------
     
    125125static int
    126126AsSwitch(
    127     ClientData clientData,      /* Not used. */
    128     Tcl_Interp *interp,         /* Interpreter to send results back to */
    129     const char *switchName,     /* Not used. */
    130     Tcl_Obj *objPtr,            /* String representation */
    131     char *record,               /* Structure record */
    132     int offset,                 /* Offset to field in structure */
    133     int flags)                  /* Not used. */
     127    ClientData clientData,        /* Not used. */
     128    Tcl_Interp *interp,                /* Interpreter to send results back to */
     129    const char *switchName,        /* Not used. */
     130    Tcl_Obj *objPtr,                /* String representation */
     131    char *record,                /* Structure record */
     132    int offset,                        /* Offset to field in structure */
     133    int flags)                        /* Not used. */
    134134{
    135135    int *flagsPtr = (int *)(record + offset);
     
    140140    c = string[0];
    141141    if ((c == 'b') && (strcmp(string, "b64") == 0)) {
    142         *flagsPtr = RPENC_B64;
     142        *flagsPtr = RPENC_B64;
    143143    } else if ((c == 'z') && (strcmp(string, "zb64") == 0)) {
    144         *flagsPtr = RPENC_Z  | RPENC_B64;
     144        *flagsPtr = RPENC_Z  | RPENC_B64;
    145145    } else if ((c == 'z') && (strcmp(string, "z") == 0)) {
    146         *flagsPtr = RPENC_Z;
     146        *flagsPtr = RPENC_Z;
    147147    } else {
    148         Tcl_AppendResult(interp, "bad value \"", string,
    149                 "\": should be b64, zb64, or z", (char *)NULL);
    150         return TCL_ERROR;
     148        Tcl_AppendResult(interp, "bad value \"", string,
     149                "\": should be b64, zb64, or z", (char *)NULL);
     150        return TCL_ERROR;
    151151    }
    152152    return TCL_OK;
     
    165165{
    166166    {SWITCH_CUSTOM, "-as", "z|b64|zb64",
    167         offsetof(EncodeSwitches, flags), 0, 0, &asSwitch},
     167        offsetof(EncodeSwitches, flags), 0, 0, &asSwitch},
    168168    {SWITCH_BITMASK, "-noheader", "",
    169         offsetof(EncodeSwitches, flags), 0, RPENC_RAW},
     169        offsetof(EncodeSwitches, flags), 0, RPENC_RAW},
    170170    {SWITCH_END}
    171171};
     
    173173static int
    174174EncodeCmd(ClientData clientData, Tcl_Interp *interp, int objc,
    175           Tcl_Obj *const *objv)
     175          Tcl_Obj *const *objv)
    176176{
    177177    if (objc < 1) {
    178178        Tcl_AppendResult(interp, "wrong # args: should be \"",
    179                 Tcl_GetString(objv[0]),
    180                 " ?-as z|b64|zb64? ?-noheader? ?--? string\"", (char*)NULL);
     179                Tcl_GetString(objv[0]),
     180                " ?-as z|b64|zb64? ?-noheader? ?--? string\"", (char*)NULL);
    181181        return TCL_ERROR;
    182182    }
     
    185185    int n;
    186186    n = Rp_ParseSwitches(interp, encodeSwitches, objc - 1, objv + 1, &switches,
    187                         SWITCH_OBJV_PARTIAL);
     187                        SWITCH_OBJV_PARTIAL);
    188188    if (n < 0) {
    189         return TCL_ERROR;
     189        return TCL_ERROR;
    190190    }
    191191    int last;
     
    193193    if ((objc - last) != 1) {
    194194        Tcl_AppendResult(interp, "wrong # args: should be \"",
    195                 Tcl_GetString(objv[0]),
    196                 " ?-as z|b64|zb64? ?-noheader? ?--? string\"", (char*)NULL);
     195                Tcl_GetString(objv[0]),
     196                " ?-as z|b64|zb64? ?-noheader? ?--? string\"", (char*)NULL);
    197197        return TCL_ERROR;
    198198    }
     
    201201    string = (const char*)Tcl_GetByteArrayFromObj(objv[last], &nBytes);
    202202    if (nBytes <= 0) {
    203         return TCL_OK;          // Nothing to encode.
     203        return TCL_OK;                // Nothing to encode.
    204204    }
    205205    Rappture::Buffer buf(string, nBytes);
     
    207207    if (!Rappture::encoding::encode(status, buf, switches.flags)) {
    208208        Tcl_AppendResult(interp, status.remark(), "\n", status.context(), NULL);
    209         return TCL_ERROR;
     209        return TCL_ERROR;
    210210    }
    211211    Tcl_SetByteArrayObj(Tcl_GetObjResult(interp),
    212                 (const unsigned char*)buf.bytes(), buf.size());
     212                (const unsigned char*)buf.bytes(), buf.size());
    213213    return TCL_OK;
    214214}
     
    225225 * ::Rappture::encoding::decode ?-as z|b64|zb64? <string>
    226226 *
    227  *      I'd rather the interface be
    228  *     
    229  *              decode -b64 -z string
     227 *        I'd rather the interface be
     228 *       
     229 *                decode -b64 -z string
    230230 */
    231231
     
    237237{
    238238    {SWITCH_CUSTOM, "-as", "z|b64|zb64",
    239         offsetof(DecodeSwitches, flags), 0, 0, &asSwitch},
     239        offsetof(DecodeSwitches, flags), 0, 0, &asSwitch},
    240240    {SWITCH_BITMASK, "-noheader", "",
    241         offsetof(DecodeSwitches, flags), 0, RPENC_RAW},
     241        offsetof(DecodeSwitches, flags), 0, RPENC_RAW},
    242242    {SWITCH_END}
    243243};
     
    245245static int
    246246DecodeCmd(ClientData clientData, Tcl_Interp *interp, int objc,
    247           Tcl_Obj *const *objv)
     247          Tcl_Obj *const *objv)
    248248{
    249249    if (objc < 1) {
    250250        Tcl_AppendResult(interp, "wrong # args: should be \"",
    251                 Tcl_GetString(objv[0]),
     251                Tcl_GetString(objv[0]),
    252252                " ?-as z|b64|zb64? ?--? <string>\"", (char*)NULL);
    253253        return TCL_ERROR;
     
    258258    int n;
    259259    n = Rp_ParseSwitches(interp, decodeSwitches, objc - 1, objv + 1, &switches,
    260                         SWITCH_OBJV_PARTIAL);
     260                        SWITCH_OBJV_PARTIAL);
    261261    if (n < 0) {
    262         return TCL_ERROR;
     262        return TCL_ERROR;
    263263    }
    264264    int last;
     
    266266    if ((objc - last) != 1) {
    267267        Tcl_AppendResult(interp, "wrong # args: should be \"",
    268                 Tcl_GetString(objv[0]),
    269                 " ?-as z|b64|zb64? ?--? string\"", (char*)NULL);
     268                Tcl_GetString(objv[0]),
     269                " ?-as z|b64|zb64? ?--? string\"", (char*)NULL);
    270270        return TCL_ERROR;
    271271    }
     
    274274    string = (const char*)Tcl_GetByteArrayFromObj(objv[last], &nBytes);
    275275    if (nBytes <= 0) {
    276         return TCL_OK;          // Nothing to decode.
     276        return TCL_OK;                // Nothing to decode.
    277277    }
    278278    Rappture::Buffer buf(string, nBytes);
     
    280280    if (!Rappture::encoding::decode(status, buf, switches.flags)) {
    281281        Tcl_AppendResult(interp, status.remark(), "\n", status.context(), NULL);
    282         return TCL_ERROR;
     282        return TCL_ERROR;
    283283    }
    284284    Tcl_SetByteArrayObj(Tcl_GetObjResult(interp),
    285                 (const unsigned char*)buf.bytes(), buf.size());
    286     return TCL_OK;
    287 }
     285                (const unsigned char*)buf.bytes(), buf.size());
     286    return TCL_OK;
     287}
  • trunk/packages/vizservers/nanovis/FlowCmd.cpp

    r1571 r1850  
    5555Rappture::SwitchSpec FlowCmd::_switches[] = {
    5656    {Rappture::SWITCH_BOOLEAN, "-arrows", "boolean",
    57         offsetof(FlowValues, showArrows), 0},
     57        offsetof(FlowValues, showArrows), 0},
    5858    {Rappture::SWITCH_CUSTOM, "-axis", "axis",
    59         offsetof(FlowValues, slicePos.axis), 0, 0, &axisSwitch},
     59        offsetof(FlowValues, slicePos.axis), 0, 0, &axisSwitch},
    6060    {Rappture::SWITCH_FLOAT, "-diffuse", "value",
    61         offsetof(FlowValues, diffuse), 0},
     61        offsetof(FlowValues, diffuse), 0},
    6262    {Rappture::SWITCH_BOOLEAN, "-hide", "boolean",
    63         offsetof(FlowValues, isHidden), 0},
     63        offsetof(FlowValues, isHidden), 0},
    6464    {Rappture::SWITCH_FLOAT, "-opacity", "value",
    65         offsetof(FlowValues, opacity), 0},
     65        offsetof(FlowValues, opacity), 0},
    6666    {Rappture::SWITCH_BOOLEAN, "-outline", "boolean",
    67         offsetof(FlowValues, showOutline), 0},
     67        offsetof(FlowValues, showOutline), 0},
    6868    {Rappture::SWITCH_CUSTOM, "-position", "number",
    69         offsetof(FlowValues, slicePos), 0, 0, &positionSwitch},
     69        offsetof(FlowValues, slicePos), 0, 0, &positionSwitch},
    7070    {Rappture::SWITCH_BOOLEAN, "-slice", "boolean",
    71         offsetof(FlowValues, sliceVisible), 0},
     71        offsetof(FlowValues, sliceVisible), 0},
    7272    {Rappture::SWITCH_FLOAT, "-specular", "value",
    73         offsetof(FlowValues, specular), 0},
     73        offsetof(FlowValues, specular), 0},
    7474    {Rappture::SWITCH_CUSTOM, "-transferfunction", "name",
    7575        offsetof(FlowValues, tfPtr), 0, 0, &transferFunctionSwitch},
    7676    {Rappture::SWITCH_BOOLEAN, "-volume", "boolean",
    77         offsetof(FlowValues, showVolume), 0},
     77        offsetof(FlowValues, showVolume), 0},
    7878    {Rappture::SWITCH_END}
    7979};
     
    8787        offsetof(FlowParticlesValues, isHidden), 0},
    8888    {Rappture::SWITCH_CUSTOM, "-position", "number",
    89         offsetof(FlowParticlesValues, position), 0, 0, &positionSwitch},
     89        offsetof(FlowParticlesValues, position), 0, 0, &positionSwitch},
    9090    {Rappture::SWITCH_FLOAT, "-size", "float",
    9191        offsetof(FlowParticlesValues, particleSize), 0},
     
    118118    _hashPtr = hPtr;
    119119    _sv.isHidden = false;
    120     _sv.position.axis = 0;              /* X_AXIS */
    121     _sv.position.value = 0.0f; 
     120    _sv.position.axis = 0;                /* X_AXIS */
     121    _sv.position.value = 0.0f;       
    122122    _sv.position.flags = RELPOS;
    123123    _sv.color.r = _sv.color.b = _sv.color.g = _sv.color.a = 1.0f;
    124124    _rendererPtr = new NvParticleRenderer(NMESH, NMESH,
    125                 /* Global nVidia Cg context */g_context);
     125                /* Global nVidia Cg context */g_context);
    126126}
    127127
     
    129129{
    130130    if (_rendererPtr != NULL) {
    131         delete _rendererPtr;
     131        delete _rendererPtr;
    132132    }
    133133    if (_hashPtr != NULL) {
    134         Tcl_DeleteHashEntry(_hashPtr);
     134        Tcl_DeleteHashEntry(_hashPtr);
    135135    }
    136136    Rappture::FreeSwitches(_switches, &_sv, 0);
     
    144144    Trace("rendering particles %s position=%g\n", _name, _sv.position.value);
    145145    Trace("rendering particles %s position=%g\n", _name,
    146           FlowCmd::GetRelativePosition(&_sv.position));
     146          FlowCmd::GetRelativePosition(&_sv.position));
    147147
    148148    _rendererPtr->setPos(FlowCmd::GetRelativePosition(&_sv.position));
     
    157157    _rendererPtr->setPos(FlowCmd::GetRelativePosition(&_sv.position));
    158158    _rendererPtr->setColor(Vector4(_sv.color.r, _sv.color.g, _sv.color.b,
    159                 _sv.color.a));
     159                _sv.color.a));
    160160    _rendererPtr->particleSize(_sv.particleSize);
    161161    _rendererPtr->setAxis(_sv.position.axis);
     
    168168    _hashPtr = hPtr;
    169169    _sv.isHidden = false;
    170     _sv.corner1.x = 0.0f;       
    171     _sv.corner1.y = 0.0f;       
    172     _sv.corner1.z = 0.0f;       
    173     _sv.corner2.x = 1.0f;       
    174     _sv.corner2.y = 1.0f;       
    175     _sv.corner2.z = 1.0f;       
     170    _sv.corner1.x = 0.0f;       
     171    _sv.corner1.y = 0.0f;       
     172    _sv.corner1.z = 0.0f;       
     173    _sv.corner2.x = 1.0f;       
     174    _sv.corner2.y = 1.0f;       
     175    _sv.corner2.z = 1.0f;       
    176176    _sv.lineWidth = 1.2f;
    177177    _sv.color.r = _sv.color.b = _sv.color.g = _sv.color.a = 1.0f;
     
    199199    sy = volPtr->height / (double)volPtr->width;
    200200    if (volPtr->depth > 0.0) {
    201         sz = volPtr->depth  / (double)volPtr->width;
     201        sz = volPtr->depth  / (double)volPtr->width;
    202202    }
    203203    glScaled(sx, sy, sz);
     
    209209
    210210    Trace("box is %g,%g %g,%g %g,%g\n",
    211           _sv.corner1.x, _sv.corner2.x,
    212           _sv.corner1.y, _sv.corner2.y,
    213           _sv.corner1.z, _sv.corner2.z);
     211          _sv.corner1.x, _sv.corner2.x,
     212          _sv.corner1.y, _sv.corner2.y,
     213          _sv.corner1.z, _sv.corner2.z);
    214214    Trace("world is %g,%g %g,%g %g,%g\n",
    215           min.x, max.x, min.y, max.y, min.z, max.z);
     215          min.x, max.x, min.y, max.y, min.z, max.z);
    216216
    217217    float x0, y0, z0, x1, y1, z1;
     
    219219    x1 = y1 = z1 = 0.0f;
    220220    if (max.y  > min.y) {
    221         y0 = (_sv.corner1.y - min.y) / (max.y - min.y);
    222         y1 = (_sv.corner2.y - min.y) / (max.y - min.y);
     221        y0 = (_sv.corner1.y - min.y) / (max.y - min.y);
     222        y1 = (_sv.corner2.y - min.y) / (max.y - min.y);
    223223    }
    224224    if (max.z > min.z) {
    225         z0 = (_sv.corner1.z - min.z) / (max.z - min.z);
    226         z1 = (_sv.corner2.z - min.z) / (max.z - min.z);
     225        z0 = (_sv.corner1.z - min.z) / (max.z - min.z);
     226        z1 = (_sv.corner2.z - min.z) / (max.z - min.z);
    227227    }
    228228    if (max.x > min.x) {
    229         x0 = (_sv.corner1.x - min.x) / (max.x - min.x);
    230         x1 = (_sv.corner2.x - min.x) / (max.x - min.x);
     229        x0 = (_sv.corner1.x - min.x) / (max.x - min.x);
     230        x1 = (_sv.corner2.x - min.x) / (max.x - min.x);
    231231    }
    232232    Trace("rendering box %g,%g %g,%g %g,%g\n", x0, x1, y0, y1, z0, z1);
     
    235235    glBegin(GL_LINE_LOOP);
    236236    {
    237         glVertex3d(x0, y0, z0);
    238         glVertex3d(x1, y0, z0);
    239         glVertex3d(x1, y1, z0);
    240         glVertex3d(x0, y1, z0);
     237        glVertex3d(x0, y0, z0);
     238        glVertex3d(x1, y0, z0);
     239        glVertex3d(x1, y1, z0);
     240        glVertex3d(x0, y1, z0);
    241241    }
    242242    glEnd();
    243243    glBegin(GL_LINE_LOOP);
    244244    {
    245         glVertex3d(x0, y0, z1);
    246         glVertex3d(x1, y0, z1);
    247         glVertex3d(x1, y1, z1);
    248         glVertex3d(x0, y1, z1);
     245        glVertex3d(x0, y0, z1);
     246        glVertex3d(x1, y0, z1);
     247        glVertex3d(x1, y1, z1);
     248        glVertex3d(x0, y1, z1);
    249249    }
    250250    glEnd();
     
    252252    glBegin(GL_LINE_LOOP);
    253253    {
    254         glVertex3d(x0, y0, z0);
    255         glVertex3d(x0, y0, z1);
    256         glVertex3d(x0, y1, z1);
    257         glVertex3d(x0, y1, z0);
     254        glVertex3d(x0, y0, z0);
     255        glVertex3d(x0, y0, z1);
     256        glVertex3d(x0, y1, z1);
     257        glVertex3d(x0, y1, z0);
    258258    }
    259259    glEnd();
     
    261261    glBegin(GL_LINE_LOOP);
    262262    {
    263         glVertex3d(x1, y0, z0);
    264         glVertex3d(x1, y0, z1);
    265         glVertex3d(x1, y1, z1);
    266         glVertex3d(x1, y1, z0);
     263        glVertex3d(x1, y0, z0);
     264        glVertex3d(x1, y0, z1);
     265        glVertex3d(x1, y1, z1);
     266        glVertex3d(x1, y1, z0);
    267267    }
    268268    glEnd();
     
    290290    _volPtr = NULL;
    291291    _cmdToken = Tcl_CreateObjCommand(interp, (char *)_name,
    292         (Tcl_ObjCmdProc *)FlowInstObjCmd, this, FlowInstDeleteProc);
     292        (Tcl_ObjCmdProc *)FlowInstObjCmd, this, FlowInstDeleteProc);
    293293    Tcl_InitHashTable(&_particlesTable, TCL_STRING_KEYS);
    294294    Tcl_InitHashTable(&_boxTable, TCL_STRING_KEYS);
     
    299299    Rappture::FreeSwitches(_switches, &_sv, 0);
    300300    if (_hashPtr != NULL) {
    301         Tcl_DeleteHashEntry(_hashPtr);
     301        Tcl_DeleteHashEntry(_hashPtr);
    302302    }
    303303    if (_fieldPtr != NULL) {
    304         delete _fieldPtr;
     304        delete _fieldPtr;
    305305    }
    306306    if (_dataPtr != NULL) {
    307         delete _dataPtr;
     307        delete _dataPtr;
    308308    }
    309309     if (_volPtr != NULL) {
    310         NanoVis::remove_volume(_volPtr);
    311         _volPtr = NULL;
     310        NanoVis::remove_volume(_volPtr);
     311        _volPtr = NULL;
    312312    }
    313313
     
    315315    FlowBoxIterator boxIter;
    316316    for (boxPtr = FirstBox(&boxIter); boxPtr != NULL;
    317         boxPtr = NextBox(&boxIter)) {
    318         boxPtr->disconnect();
    319         delete boxPtr;
    320     }   
     317        boxPtr = NextBox(&boxIter)) {
     318        boxPtr->disconnect();
     319        delete boxPtr;
     320    }       
    321321    FlowParticles *particlesPtr;
    322322    FlowParticlesIterator partIter;
    323323    for (particlesPtr = FirstParticles(&partIter); particlesPtr != NULL;
    324         particlesPtr = NextParticles(&partIter)) {
    325         particlesPtr->disconnect();
    326         delete particlesPtr;
    327     }   
     324        particlesPtr = NextParticles(&partIter)) {
     325        particlesPtr->disconnect();
     326        delete particlesPtr;
     327    }       
    328328    Tcl_DeleteHashTable(&_particlesTable);
    329329    Tcl_DeleteHashTable(&_boxTable);
     
    336336    FlowParticles *particlesPtr;
    337337    for (particlesPtr = FirstParticles(&iter); particlesPtr != NULL;
    338         particlesPtr = NextParticles(&iter)) {
    339         particlesPtr->Reset();
     338        particlesPtr = NextParticles(&iter)) {
     339        particlesPtr->Reset();
    340340    }
    341341}
     
    350350    FlowParticles *particlesPtr;
    351351    for (particlesPtr = FirstParticles(&iter); particlesPtr != NULL;
    352         particlesPtr = NextParticles(&iter)) {
    353         if (particlesPtr->visible()) {
    354             particlesPtr->Advect();
    355         }
     352        particlesPtr = NextParticles(&iter)) {
     353        if (particlesPtr->visible()) {
     354            particlesPtr->Advect();
     355        }
    356356    }
    357357}
     
    365365    FlowParticles *particlesPtr;
    366366    for (particlesPtr = FirstParticles(&iter); particlesPtr != NULL;
    367         particlesPtr = NextParticles(&iter)) {
    368         if (particlesPtr->visible()) {
    369             particlesPtr->Render();
    370         }
     367        particlesPtr = NextParticles(&iter)) {
     368        if (particlesPtr->visible()) {
     369            particlesPtr->Render();
     370        }
    371371    }
    372372    Trace("in Render before boxes %s\n", _name);
     
    382382    hPtr = Tcl_CreateHashEntry(&_particlesTable, particlesName, &isNew);
    383383    if (!isNew) {
    384         Tcl_AppendResult(interp, "particle injection plane \"",
    385                         particlesName, "\" already exists.", (char *)NULL);
    386         return TCL_ERROR;
     384        Tcl_AppendResult(interp, "particle injection plane \"",
     385                        particlesName, "\" already exists.", (char *)NULL);
     386        return TCL_ERROR;
    387387    }
    388388    particlesName = Tcl_GetHashKey(&_particlesTable, hPtr);
     
    390390    particlesPtr = new FlowParticles(particlesName, hPtr);
    391391    if (particlesPtr == NULL) {
    392         Tcl_AppendResult(interp, "can't allocate particle injection plane",
    393                 (char *)NULL);
    394         Tcl_DeleteHashEntry(hPtr);
    395         return TCL_ERROR;
     392        Tcl_AppendResult(interp, "can't allocate particle injection plane",
     393                (char *)NULL);
     394        Tcl_DeleteHashEntry(hPtr);
     395        return TCL_ERROR;
    396396    }
    397397    Tcl_SetHashValue(hPtr, particlesPtr);
     
    401401int
    402402FlowCmd::GetParticles(Tcl_Interp *interp, Tcl_Obj *objPtr,
    403                       FlowParticles **particlesPtrPtr)
     403                      FlowParticles **particlesPtrPtr)
    404404{
    405405    Tcl_HashEntry *hPtr;
    406406    hPtr = Tcl_FindHashEntry(&_particlesTable, Tcl_GetString(objPtr));
    407407    if (hPtr == NULL) {
    408         if (interp != NULL) {
    409             Tcl_AppendResult(interp, "can't find a particle injection plane \"",
    410                         Tcl_GetString(objPtr), "\"", (char *)NULL);
    411         }
    412         return TCL_ERROR;
     408        if (interp != NULL) {
     409            Tcl_AppendResult(interp, "can't find a particle injection plane \"",
     410                        Tcl_GetString(objPtr), "\"", (char *)NULL);
     411        }
     412        return TCL_ERROR;
    413413    }
    414414    *particlesPtrPtr = (FlowParticles *)Tcl_GetHashValue(hPtr);
     
    420420{
    421421    iterPtr->hashPtr = Tcl_FirstHashEntry(&_particlesTable,
    422         &iterPtr->hashSearch);
     422        &iterPtr->hashSearch);
    423423    if (iterPtr->hashPtr == NULL) {
    424         return NULL;
     424        return NULL;
    425425    }
    426426    return (FlowParticles *)Tcl_GetHashValue(iterPtr->hashPtr);
     
    431431{
    432432    if (iterPtr->hashPtr == NULL) {
    433         return NULL;
     433        return NULL;
    434434    }
    435435    iterPtr->hashPtr = Tcl_NextHashEntry(&iterPtr->hashSearch);
    436436    if (iterPtr->hashPtr == NULL) {
    437         return NULL;
     437        return NULL;
    438438    }
    439439    return (FlowParticles *)Tcl_GetHashValue(iterPtr->hashPtr);
     
    447447    hPtr = Tcl_CreateHashEntry(&_boxTable, Tcl_GetString(objPtr), &isNew);
    448448    if (!isNew) {
    449         Tcl_AppendResult(interp, "box \"", Tcl_GetString(objPtr),
    450                 "\" already exists in flow \"", name(), "\"", (char *)NULL);
    451         return TCL_ERROR;
     449        Tcl_AppendResult(interp, "box \"", Tcl_GetString(objPtr),
     450                "\" already exists in flow \"", name(), "\"", (char *)NULL);
     451        return TCL_ERROR;
    452452    }
    453453    const char *boxName;
     
    456456    boxPtr = new FlowBox(boxName, hPtr);
    457457    if (boxPtr == NULL) {
    458         Tcl_AppendResult(interp, "can't allocate box \"", boxName, "\"",
    459                         (char *)NULL);
    460         Tcl_DeleteHashEntry(hPtr);
    461         return TCL_ERROR;
     458        Tcl_AppendResult(interp, "can't allocate box \"", boxName, "\"",
     459                        (char *)NULL);
     460        Tcl_DeleteHashEntry(hPtr);
     461        return TCL_ERROR;
    462462    }
    463463    Tcl_SetHashValue(hPtr, boxPtr);
     
    471471    hPtr = Tcl_FindHashEntry(&_boxTable, Tcl_GetString(objPtr));
    472472    if (hPtr == NULL) {
    473         if (interp != NULL) {
    474             Tcl_AppendResult(interp, "can't find a box \"",
    475                 Tcl_GetString(objPtr), "\" in flow \"", name(), "\"",
    476                 (char *)NULL);
    477         }
    478         return TCL_ERROR;
     473        if (interp != NULL) {
     474            Tcl_AppendResult(interp, "can't find a box \"",
     475                Tcl_GetString(objPtr), "\" in flow \"", name(), "\"",
     476                (char *)NULL);
     477        }
     478        return TCL_ERROR;
    479479    }
    480480    *boxPtrPtr = (FlowBox *)Tcl_GetHashValue(hPtr);
     
    487487    iterPtr->hashPtr = Tcl_FirstHashEntry(&_boxTable, &iterPtr->hashSearch);
    488488    if (iterPtr->hashPtr == NULL) {
    489         return NULL;
     489        return NULL;
    490490    }
    491491    return (FlowBox *)Tcl_GetHashValue(iterPtr->hashPtr);
     
    496496{
    497497    if (iterPtr->hashPtr == NULL) {
    498         return NULL;
     498        return NULL;
    499499    }
    500500    iterPtr->hashPtr = Tcl_NextHashEntry(&iterPtr->hashSearch);
    501501    if (iterPtr->hashPtr == NULL) {
    502         return NULL;
     502        return NULL;
    503503    }
    504504    return (FlowBox *)Tcl_GetHashValue(iterPtr->hashPtr);
     
    512512    FlowParticlesIterator iter;
    513513    for (particlesPtr = FirstParticles(&iter); particlesPtr != NULL;
    514         particlesPtr = NextParticles(&iter)) {
    515         particlesPtr->Initialize();
    516     }   
     514        particlesPtr = NextParticles(&iter)) {
     515        particlesPtr->Initialize();
     516    }       
    517517}
    518518
     
    521521{
    522522    if (_volPtr != NULL) {
    523         fprintf(stderr, "from ScaleVectorField volId=%s\n", _volPtr->name());
    524         NanoVis::remove_volume(_volPtr);
    525         _volPtr = NULL;
     523        fprintf(stderr, "from ScaleVectorField volId=%s\n", _volPtr->name());
     524        NanoVis::remove_volume(_volPtr);
     525        _volPtr = NULL;
    526526    }
    527527    float *vdata;
    528528    vdata = GetScaledVector();
    529529    if (vdata == NULL) {
    530         return false;
     530        return false;
    531531    }
    532532    Volume *volPtr;
     
    534534    delete [] vdata;
    535535    if (volPtr == NULL) {
    536         return false;
     536        return false;
    537537    }
    538538    _volPtr = volPtr;
     
    540540    // Remove the associated vector field.
    541541    if (_fieldPtr != NULL) {
    542         delete _fieldPtr;
     542        delete _fieldPtr;
    543543    }
    544544    _fieldPtr = new NvVectorField();
    545545    if (_fieldPtr == NULL) {
    546         return false;
     546        return false;
    547547    }
    548548
     
    559559
    560560    _fieldPtr->setVectorField(_volPtr, loc,
    561         1.0f, height / width, depth  / width, NanoVis::magMax);
     561        1.0f, height / width, depth  / width, NanoVis::magMax);
    562562
    563563    if (NanoVis::licRenderer != NULL) {
    564564        NanoVis::licRenderer->setVectorField(_volPtr->id, loc,
    565                 1.0f / _volPtr->aspect_ratio_width,
    566                 1.0f / _volPtr->aspect_ratio_height,
    567                 1.0f / _volPtr->aspect_ratio_depth,
    568                 _volPtr->wAxis.max());
    569         SetCurrentPosition();
    570         SetAxis();
    571         SetActive();
     565                1.0f / _volPtr->aspect_ratio_width,
     566                1.0f / _volPtr->aspect_ratio_height,
     567                1.0f / _volPtr->aspect_ratio_depth,
     568                _volPtr->wAxis.max());
     569        SetCurrentPosition();
     570        SetAxis();
     571        SetActive();
    572572    }
    573573
     
    576576            //*(volPtr->get_location()),
    577577            1.0f,
    578             _volPtr->aspect_ratio_height / _volPtr->aspect_ratio_width,
    579             _volPtr->aspect_ratio_depth / _volPtr->aspect_ratio_width
     578            _volPtr->aspect_ratio_height / _volPtr->aspect_ratio_width,
     579            _volPtr->aspect_ratio_depth / _volPtr->aspect_ratio_width
    580580            //,volPtr->wAxis.max()
    581581            );
    582         Trace("Arrows enabled set to %d\n", _sv.showArrows);
    583         NanoVis::velocityArrowsSlice->axis(_sv.slicePos.axis);
    584         NanoVis::velocityArrowsSlice->slicePos(_sv.slicePos.value);
    585         NanoVis::velocityArrowsSlice->enabled(_sv.showArrows);
     582        Trace("Arrows enabled set to %d\n", _sv.showArrows);
     583        NanoVis::velocityArrowsSlice->axis(_sv.slicePos.axis);
     584        NanoVis::velocityArrowsSlice->slicePos(_sv.slicePos.value);
     585        NanoVis::velocityArrowsSlice->enabled(_sv.showArrows);
    586586    }
    587587    FlowParticles *particlesPtr;
    588588    FlowParticlesIterator partIter;
    589589    for (particlesPtr = FirstParticles(&partIter); particlesPtr != NULL;
    590         particlesPtr = NextParticles(&partIter)) {
    591         particlesPtr->SetVectorField(_volPtr);
    592     }   
     590        particlesPtr = NextParticles(&partIter)) {
     591        particlesPtr->SetVectorField(_volPtr);
     592    }       
    593593    return true;
    594594}
     
    600600    FlowBox *boxPtr;
    601601    for (boxPtr = FirstBox(&iter); boxPtr != NULL; boxPtr = NextBox(&iter)) {
    602         Trace("found box %s\n", boxPtr->name());
    603         if (boxPtr->visible()) {
    604             boxPtr->Render(_volPtr);
    605         }
     602        Trace("found box %s\n", boxPtr->name());
     603        if (boxPtr->visible()) {
     604            boxPtr->Render(_volPtr);
     605        }
    606606    }
    607607}
     
    614614    float *data = new float[n];
    615615    if (data == NULL) {
    616         return NULL;
     616        return NULL;
    617617    }
    618618    memset(data, 0, sizeof(float) * n);
     
    620620    const float *values = _dataPtr->values();
    621621    for (size_t iz=0; iz < _dataPtr->zNum(); iz++) {
    622         for (size_t iy=0; iy < _dataPtr->yNum(); iy++) {
    623             for (size_t ix=0; ix < _dataPtr->xNum(); ix++) {
    624                 double vx, vy, vz, vm;
    625                 vx = values[0];
    626                 vy = values[1];
    627                 vz = values[2];
    628                 vm = sqrt(vx*vx + vy*vy + vz*vz);
    629                 destPtr[0] = vm / NanoVis::magMax;
    630                 destPtr[1] = vx /(2.0*NanoVis::magMax) + 0.5;
    631                 destPtr[2] = vy /(2.0*NanoVis::magMax) + 0.5;
    632                 destPtr[3] = vz /(2.0*NanoVis::magMax) + 0.5;
    633                 values += 3;
    634                 destPtr += 4;
    635             }
    636         }
     622        for (size_t iy=0; iy < _dataPtr->yNum(); iy++) {
     623            for (size_t ix=0; ix < _dataPtr->xNum(); ix++) {
     624                double vx, vy, vz, vm;
     625                vx = values[0];
     626                vy = values[1];
     627                vz = values[2];
     628                vm = sqrt(vx*vx + vy*vy + vz*vz);
     629                destPtr[0] = vm / NanoVis::magMax;
     630                destPtr[1] = vx /(2.0*NanoVis::magMax) + 0.5;
     631                destPtr[2] = vy /(2.0*NanoVis::magMax) + 0.5;
     632                destPtr[3] = vz /(2.0*NanoVis::magMax) + 0.5;
     633                values += 3;
     634                destPtr += 4;
     635            }
     636        }
    637637    }
    638638    return data;
     
    645645
    646646    volPtr = NanoVis::load_volume(_name, _dataPtr->xNum(), _dataPtr->yNum(),
    647                                   _dataPtr->zNum(), 4, data,
    648                                   NanoVis::magMin, NanoVis::magMax, 0);
     647                                  _dataPtr->zNum(), 4, data,
     648                                  NanoVis::magMin, NanoVis::magMax, 0);
    649649    volPtr->xAxis.SetRange(_dataPtr->xMin(), _dataPtr->xMax());
    650650    volPtr->yAxis.SetRange(_dataPtr->yMin(), _dataPtr->yMax());
     
    655655    Vector3 physicalMax(NanoVis::xMax, NanoVis::yMax, NanoVis::zMax);
    656656    Trace("min=%g %g %g max=%g %g %g mag=%g %g\n",
    657             NanoVis::xMin, NanoVis::yMin, NanoVis::zMin,
    658             NanoVis::xMax, NanoVis::yMax, NanoVis::zMax,
    659             NanoVis::magMin, NanoVis::magMax);
     657            NanoVis::xMin, NanoVis::yMin, NanoVis::zMin,
     658            NanoVis::xMax, NanoVis::yMax, NanoVis::zMax,
     659            NanoVis::magMin, NanoVis::magMax);
    660660    volPtr->setPhysicalBBox(physicalMin, physicalMax);
    661661    //volPtr->set_n_slice(256 - _volIndex);
     
    689689static int
    690690FlowDataFileOp(ClientData clientData, Tcl_Interp *interp, int objc,
    691                Tcl_Obj *const *objv)
     691               Tcl_Obj *const *objv)
    692692{
    693693    Rappture::Outcome result;
     
    702702    }
    703703    if ((nComponents < 1) || (nComponents > 4)) {
    704         Tcl_AppendResult(interp, "bad # of components \"",
    705                         Tcl_GetString(objv[4]), "\"", (char *)NULL);
    706         return TCL_ERROR;
     704        Tcl_AppendResult(interp, "bad # of components \"",
     705                        Tcl_GetString(objv[4]), "\"", (char *)NULL);
     706        return TCL_ERROR;
    707707    }
    708708    Rappture::Buffer buf;
    709709    if (!buf.load(result, fileName)) {
    710         Tcl_AppendResult(interp, "can't load data from \"", fileName, "\": ",
    711                         result.remark(), (char *)NULL);
    712         return TCL_ERROR;
     710        Tcl_AppendResult(interp, "can't load data from \"", fileName, "\": ",
     711                        result.remark(), (char *)NULL);
     712        return TCL_ERROR;
    713713    }
    714714
     
    719719    char *bytes = (char *)buf.bytes();
    720720    if ((length > 4) && (strncmp(bytes, "<DX>", 4) == 0)) {
    721         if (!dataPtr->ImportDx(result, nComponents, length-4, bytes+4)) {
    722             Tcl_AppendResult(interp, result.remark(), (char *)NULL);
    723             delete dataPtr;
    724             return TCL_ERROR;
    725         }
     721        if (!dataPtr->ImportDx(result, nComponents, length-4, bytes+4)) {
     722            Tcl_AppendResult(interp, result.remark(), (char *)NULL);
     723            delete dataPtr;
     724            return TCL_ERROR;
     725        }
    726726    } else if ((length > 10) && (strncmp(bytes, "unirect3d ", 10) == 0)) {
    727         if (dataPtr->ParseBuffer(interp, buf) != TCL_OK) {
    728             delete dataPtr;
    729             return TCL_ERROR;
    730         }
     727        if (dataPtr->ParseBuffer(interp, buf) != TCL_OK) {
     728            delete dataPtr;
     729            return TCL_ERROR;
     730        }
    731731    } else if ((length > 10) && (strncmp(bytes, "unirect2d ", 10) == 0)) {
    732         Rappture::Unirect2d *u2dPtr;
    733         u2dPtr = new Rappture::Unirect2d(nComponents);
    734         if (u2dPtr->ParseBuffer(interp, buf) != TCL_OK) {
    735             delete u2dPtr;
    736             return TCL_ERROR;
    737         }
    738         dataPtr->Convert(u2dPtr);
    739         delete u2dPtr;
     732        Rappture::Unirect2d *u2dPtr;
     733        u2dPtr = new Rappture::Unirect2d(nComponents);
     734        if (u2dPtr->ParseBuffer(interp, buf) != TCL_OK) {
     735            delete u2dPtr;
     736            return TCL_ERROR;
     737        }
     738        dataPtr->Convert(u2dPtr);
     739        delete u2dPtr;
    740740    } else {
    741         fprintf(stderr, "header is %.14s\n", buf.bytes());
    742         if (!dataPtr->ImportDx(result, nComponents, length, bytes)) {
    743             Tcl_AppendResult(interp, result.remark(), (char *)NULL);
    744             delete dataPtr;
    745             return TCL_ERROR;
    746         }
     741        fprintf(stderr, "header is %.14s\n", buf.bytes());
     742        if (!dataPtr->ImportDx(result, nComponents, length, bytes)) {
     743            Tcl_AppendResult(interp, result.remark(), (char *)NULL);
     744            delete dataPtr;
     745            return TCL_ERROR;
     746        }
    747747    }
    748748    if (dataPtr->nValues() == 0) {
    749         delete dataPtr;
    750         Tcl_AppendResult(interp, "no data found in \"", fileName, "\"",
    751                         (char *)NULL);
    752         return TCL_ERROR;
     749        delete dataPtr;
     750        Tcl_AppendResult(interp, "no data found in \"", fileName, "\"",
     751                        (char *)NULL);
     752        return TCL_ERROR;
    753753    }
    754754    flowPtr->data(dataPtr);
     
    770770    int nBytes;
    771771    if (Tcl_GetIntFromObj(interp, objv[3], &nBytes) != TCL_OK) {
    772         Trace("Bad nBytes \"%s\"\n", Tcl_GetString(objv[3]));
     772        Trace("Bad nBytes \"%s\"\n", Tcl_GetString(objv[3]));
    773773        return TCL_ERROR;
    774774    }
    775775    if (nBytes <= 0) {
    776         Tcl_AppendResult(interp, "bad # bytes request \"",
    777                 Tcl_GetString(objv[3]), "\" for \"data follows\"", (char *)NULL);
    778         Trace("Bad nbytes %d\n", nBytes);
    779         return TCL_ERROR;
     776        Tcl_AppendResult(interp, "bad # bytes request \"",
     777                Tcl_GetString(objv[3]), "\" for \"data follows\"", (char *)NULL);
     778        Trace("Bad nbytes %d\n", nBytes);
     779        return TCL_ERROR;
    780780    }
    781781    int nComponents;
    782782    if (Tcl_GetIntFromObj(interp, objv[4], &nComponents) != TCL_OK) {
    783         Trace("Bad # of components \"%s\"\n", Tcl_GetString(objv[4]));
     783        Trace("Bad # of components \"%s\"\n", Tcl_GetString(objv[4]));
    784784        return TCL_ERROR;
    785785    }
    786786    if (nComponents <= 0) {
    787         Tcl_AppendResult(interp, "bad # of components request \"",
    788                 Tcl_GetString(objv[4]), "\" for \"data follows\"", (char *)NULL);
    789         Trace("Bad # of components %d\n", nComponents);
    790         return TCL_ERROR;
     787        Tcl_AppendResult(interp, "bad # of components request \"",
     788                Tcl_GetString(objv[4]), "\" for \"data follows\"", (char *)NULL);
     789        Trace("Bad # of components %d\n", nComponents);
     790        return TCL_ERROR;
    791791    }
    792792    Rappture::Buffer buf;
     
    802802    char *bytes = (char *)buf.bytes();
    803803    if ((length > 4) && (strncmp(bytes, "<DX>", 4) == 0)) {
    804         if (!dataPtr->ImportDx(result, nComponents, length - 4, bytes + 4)) {
    805             Tcl_AppendResult(interp, result.remark(), (char *)NULL);
    806             delete dataPtr;
    807             return TCL_ERROR;
    808         }
     804        if (!dataPtr->ImportDx(result, nComponents, length - 4, bytes + 4)) {
     805            Tcl_AppendResult(interp, result.remark(), (char *)NULL);
     806            delete dataPtr;
     807            return TCL_ERROR;
     808        }
    809809    } else if ((length > 10) && (strncmp(bytes, "unirect3d ", 10) == 0)) {
    810         if (dataPtr->ParseBuffer(interp, buf) != TCL_OK) {
    811             delete dataPtr;
    812             return TCL_ERROR;
    813         }
     810        if (dataPtr->ParseBuffer(interp, buf) != TCL_OK) {
     811            delete dataPtr;
     812            return TCL_ERROR;
     813        }
    814814    } else if ((length > 10) && (strncmp(bytes, "unirect2d ", 10) == 0)) {
    815         Rappture::Unirect2d *u2dPtr;
    816         u2dPtr = new Rappture::Unirect2d(nComponents);
    817         if (u2dPtr->ParseBuffer(interp, buf) != TCL_OK) {
    818             delete u2dPtr;
    819             return TCL_ERROR;
    820         }
    821         dataPtr->Convert(u2dPtr);
    822         delete u2dPtr;
     815        Rappture::Unirect2d *u2dPtr;
     816        u2dPtr = new Rappture::Unirect2d(nComponents);
     817        if (u2dPtr->ParseBuffer(interp, buf) != TCL_OK) {
     818            delete u2dPtr;
     819            return TCL_ERROR;
     820        }
     821        dataPtr->Convert(u2dPtr);
     822        delete u2dPtr;
    823823    } else {
    824         fprintf(stderr, "header is %.14s\n", buf.bytes());
    825         if (!dataPtr->ImportDx(result, nComponents, length, bytes)) {
    826             Tcl_AppendResult(interp, result.remark(), (char *)NULL);
    827             delete dataPtr;
    828             return TCL_ERROR;
    829         }
     824        fprintf(stderr, "header is %.14s\n", buf.bytes());
     825        if (!dataPtr->ImportDx(result, nComponents, length, bytes)) {
     826            Tcl_AppendResult(interp, result.remark(), (char *)NULL);
     827            delete dataPtr;
     828            return TCL_ERROR;
     829        }
    830830    }
    831831    if (dataPtr->nValues() == 0) {
    832         delete dataPtr;
    833         Tcl_AppendResult(interp, "no data found in stream", (char *)NULL);
    834         return TCL_ERROR;
     832        delete dataPtr;
     833        Tcl_AppendResult(interp, "no data found in stream", (char *)NULL);
     834        return TCL_ERROR;
    835835    }
    836836    flowPtr->data(dataPtr);
    837837    {
    838838        char info[1024];
    839         ssize_t nWritten;
    840         size_t length;
     839        ssize_t nWritten;
     840        size_t length;
    841841
    842842        length = sprintf(info, "nv>data tag %s min %g max %g\n",
    843                 flowPtr->name(), dataPtr->magMin(), dataPtr->magMax());
     843                flowPtr->name(), dataPtr->magMin(), dataPtr->magMax());
    844844        nWritten  = write(0, info, length);
    845         assert(nWritten == (ssize_t)strlen(info));
     845        assert(nWritten == (ssize_t)strlen(info));
    846846    }
    847847    NanoVis::EventuallyRedraw(NanoVis::MAP_FLOWS);
     
    857857static int
    858858FlowDataOp(ClientData clientData, Tcl_Interp *interp, int objc,
    859            Tcl_Obj *const *objv)
     859           Tcl_Obj *const *objv)
    860860{
    861861    Tcl_ObjCmdProc *proc;
     
    873873{
    874874    if (posPtr->flags == RELPOS) {
    875         return posPtr->value;
     875        return posPtr->value;
    876876    }
    877877    switch (posPtr->axis) {
    878878    case AXIS_X: 
    879         return (posPtr->value - NanoVis::xMin) /
    880             (NanoVis::xMax - NanoVis::xMin);
     879        return (posPtr->value - NanoVis::xMin) /
     880            (NanoVis::xMax - NanoVis::xMin);
    881881    case AXIS_Y: 
    882         return (posPtr->value - NanoVis::yMin) /
    883             (NanoVis::yMax - NanoVis::yMin);
     882        return (posPtr->value - NanoVis::yMin) /
     883            (NanoVis::yMax - NanoVis::yMin);
    884884    case AXIS_Z: 
    885         return (posPtr->value - NanoVis::zMin) /
    886             (NanoVis::zMax - NanoVis::zMin);
     885        return (posPtr->value - NanoVis::zMin) /
     886            (NanoVis::zMax - NanoVis::zMin);
    887887    }
    888888    return 0.0;
     
    908908    iterPtr->hashPtr = Tcl_FirstHashEntry(&flowTable, &iterPtr->hashSearch);
    909909    if (iterPtr->hashPtr == NULL) {
    910         return NULL;
     910        return NULL;
    911911    }
    912912    return (FlowCmd *)Tcl_GetHashValue(iterPtr->hashPtr);
     
    917917{
    918918    if (iterPtr->hashPtr == NULL) {
    919         return NULL;
     919        return NULL;
    920920    }
    921921    iterPtr->hashPtr = Tcl_NextHashEntry(&iterPtr->hashSearch);
    922922    if (iterPtr->hashPtr == NULL) {
    923         return NULL;
     923        return NULL;
    924924    }
    925925    return (FlowCmd *)Tcl_GetHashValue(iterPtr->hashPtr);
     
    932932    hPtr = Tcl_FindHashEntry(&flowTable, Tcl_GetString(objPtr));
    933933    if (hPtr == NULL) {
    934         if (interp != NULL) {
    935             Tcl_AppendResult(interp, "can't find a flow \"",
    936                              Tcl_GetString(objPtr), "\"", (char *)NULL);
    937         }
    938         return TCL_ERROR;
     934        if (interp != NULL) {
     935            Tcl_AppendResult(interp, "can't find a flow \"",
     936                             Tcl_GetString(objPtr), "\"", (char *)NULL);
     937        }
     938        return TCL_ERROR;
    939939    }
    940940    *flowPtrPtr = (FlowCmd *)Tcl_GetHashValue(hPtr);
     
    951951    hPtr = Tcl_CreateHashEntry(&flowTable, name, &isNew);
    952952    if (!isNew) {
    953         Tcl_AppendResult(interp, "flow \"", name, "\" already exists.",
    954                         (char *)NULL);
    955         return TCL_ERROR;
     953        Tcl_AppendResult(interp, "flow \"", name, "\" already exists.",
     954                        (char *)NULL);
     955        return TCL_ERROR;
    956956    }
    957957    Tcl_CmdInfo cmdInfo;
    958958    if (Tcl_GetCommandInfo(interp, name, &cmdInfo)) {
    959         Tcl_AppendResult(interp, "an another command \"", name,
    960                         "\" already exists.", (char *)NULL);
    961         return TCL_ERROR;
    962     }   
     959        Tcl_AppendResult(interp, "an another command \"", name,
     960                        "\" already exists.", (char *)NULL);
     961        return TCL_ERROR;
     962    }       
    963963    FlowCmd *flowPtr;
    964964    name = Tcl_GetHashKey(&flowTable, hPtr);
    965965    flowPtr = new FlowCmd(interp, name, hPtr);
    966966    if (flowPtr == NULL) {
    967         Tcl_AppendResult(interp, "can't allocate a flow object \"", name,
    968                         "\"", (char *)NULL);
    969         return TCL_ERROR;
     967        Tcl_AppendResult(interp, "can't allocate a flow object \"", name,
     968                        "\"", (char *)NULL);
     969        return TCL_ERROR;
    970970    }
    971971    Tcl_SetHashValue(hPtr, flowPtr);
     
    979979    FlowIterator iter;
    980980    for (flowPtr = FirstFlow(&iter); flowPtr != NULL;
    981         flowPtr = NextFlow(&iter)) {
    982         flowPtr->disconnect();          /* Don't disrupt the hash walk */
    983         Tcl_DeleteCommand(interp, flowPtr->name());
     981        flowPtr = NextFlow(&iter)) {
     982        flowPtr->disconnect();                /* Don't disrupt the hash walk */
     983        Tcl_DeleteCommand(interp, flowPtr->name());
    984984    }
    985985    Tcl_DeleteHashTable(&flowTable);
     
    994994    /*
    995995     * Step 1.  Get the overall min and max magnitudes of all the
    996      *          flow vectors.
     996     *                flow vectors.
    997997     */
    998998    magMin = DBL_MAX, magMax = -DBL_MAX;
     
    10011001    FlowIterator iter;
    10021002    for (flowPtr = FirstFlow(&iter); flowPtr != NULL;
    1003         flowPtr = NextFlow(&iter)) {
    1004         double min, max;
    1005         if (!flowPtr->isDataLoaded()) {
    1006             continue;
    1007         }
    1008         Rappture::Unirect3d *dataPtr;
    1009         dataPtr = flowPtr->data();
    1010         min = dataPtr->magMin();
    1011         max = dataPtr->magMax();
    1012         if (min < magMin) {
    1013             magMin = min;
    1014         }
    1015         if (max > magMax) {
    1016             magMax = max;
    1017         }
    1018         if (dataPtr->xMin() < xMin) {
    1019             xMin = dataPtr->xMin();
    1020         }
    1021         if (dataPtr->yMin() < yMin) {
    1022             yMin = dataPtr->yMin();
    1023         }
    1024         if (dataPtr->zMin() < zMin) {
    1025             zMin = dataPtr->zMin();
    1026         }
    1027         if (dataPtr->xMax() > xMax) {
    1028             xMax = dataPtr->xMax();
    1029         }
    1030         if (dataPtr->yMax() > yMax) {
    1031             yMax = dataPtr->yMax();
    1032         }
    1033         if (dataPtr->zMax() > zMax) {
    1034             zMax = dataPtr->zMax();
    1035         }
     1003        flowPtr = NextFlow(&iter)) {
     1004        double min, max;
     1005        if (!flowPtr->isDataLoaded()) {
     1006            continue;
     1007        }
     1008        Rappture::Unirect3d *dataPtr;
     1009        dataPtr = flowPtr->data();
     1010        min = dataPtr->magMin();
     1011        max = dataPtr->magMax();
     1012        if (min < magMin) {
     1013            magMin = min;
     1014        }
     1015        if (max > magMax) {
     1016            magMax = max;
     1017        }
     1018        if (dataPtr->xMin() < xMin) {
     1019            xMin = dataPtr->xMin();
     1020        }
     1021        if (dataPtr->yMin() < yMin) {
     1022            yMin = dataPtr->yMin();
     1023        }
     1024        if (dataPtr->zMin() < zMin) {
     1025            zMin = dataPtr->zMin();
     1026        }
     1027        if (dataPtr->xMax() > xMax) {
     1028            xMax = dataPtr->xMax();
     1029        }
     1030        if (dataPtr->yMax() > yMax) {
     1031            yMax = dataPtr->yMax();
     1032        }
     1033        if (dataPtr->zMax() > zMax) {
     1034            zMax = dataPtr->zMax();
     1035        }
    10361036    }
    10371037    Trace("MapFlows magMin=%g magMax=%g\n", NanoVis::magMin, NanoVis::magMax);
     
    10411041     */
    10421042    for (flowPtr = FirstFlow(&iter); flowPtr != NULL;
    1043         flowPtr = NextFlow(&iter)) {
    1044         if (!flowPtr->isDataLoaded()) {
    1045             continue;                   // Flow exists, but no data has
    1046                                         // been loaded yet.
    1047         }
    1048         if (flowPtr->visible()) {
    1049             flowPtr->InitializeParticles();
    1050         }
    1051         if (!flowPtr->ScaleVectorField()) {
    1052             return false;
    1053         }
    1054         // FIXME: This doesn't work when there is more than one flow.
    1055         licRenderer->set_offset(flowPtr->GetRelativePosition());
     1043        flowPtr = NextFlow(&iter)) {
     1044        if (!flowPtr->isDataLoaded()) {
     1045            continue;                        // Flow exists, but no data has
     1046                                        // been loaded yet.
     1047        }
     1048        if (flowPtr->visible()) {
     1049            flowPtr->InitializeParticles();
     1050        }
     1051        if (!flowPtr->ScaleVectorField()) {
     1052            return false;
     1053        }
     1054        // FIXME: This doesn't work when there is more than one flow.
     1055        licRenderer->set_offset(flowPtr->GetRelativePosition());
    10561056        NanoVis::velocityArrowsSlice->slicePos(flowPtr->GetRelativePosition());
    10571057       
     
    10671067    FlowIterator iter;
    10681068    for (flowPtr = FirstFlow(&iter); flowPtr != NULL;
    1069         flowPtr = NextFlow(&iter)) {
    1070         if ((flowPtr->isDataLoaded()) && (flowPtr->visible())) {
    1071             flowPtr->Render();
    1072         }
     1069        flowPtr = NextFlow(&iter)) {
     1070        if ((flowPtr->isDataLoaded()) && (flowPtr->visible())) {
     1071            flowPtr->Render();
     1072        }
    10731073    }
    10741074    flags &= ~REDRAW_PENDING;
     
    10821082
    10831083    if (licRenderer->active()) {
    1084         NanoVis::licRenderer->reset();
     1084        NanoVis::licRenderer->reset();
    10851085    }
    10861086    for (flowPtr = FirstFlow(&iter); flowPtr != NULL;
    1087         flowPtr = NextFlow(&iter)) {
    1088         if ((flowPtr->isDataLoaded()) && (flowPtr->visible())) {
    1089             flowPtr->ResetParticles();
    1090         }
     1087        flowPtr = NextFlow(&iter)) {
     1088        if ((flowPtr->isDataLoaded()) && (flowPtr->visible())) {
     1089            flowPtr->ResetParticles();
     1090        }
    10911091    }
    10921092}   
     
    10981098    FlowIterator iter;
    10991099    for (flowPtr = FirstFlow(&iter); flowPtr != NULL;
    1100         flowPtr = NextFlow(&iter)) {
    1101         if ((flowPtr->isDataLoaded()) && (flowPtr->visible())) {
    1102             flowPtr->Advect();
    1103         }
     1100        flowPtr = NextFlow(&iter)) {
     1101        if ((flowPtr->isDataLoaded()) && (flowPtr->visible())) {
     1102            flowPtr->Advect();
     1103        }
    11041104    }
    11051105}   
     
    11101110 * AxisSwitchProc --
    11111111 *
    1112  *      Convert a Tcl_Obj representing the label of a child node into its
    1113  *      integer node id.
     1112 *        Convert a Tcl_Obj representing the label of a child node into its
     1113 *        integer node id.
    11141114 *
    11151115 * Results:
    1116  *      The return value is a standard Tcl result.
     1116 *        The return value is a standard Tcl result.
    11171117 *
    11181118 *---------------------------------------------------------------------------
     
    11211121static int
    11221122AxisSwitchProc(
    1123     ClientData clientData,      /* Flag indicating if the node is considered
    1124                                 * before or after the insertion position. */
    1125     Tcl_Interp *interp,         /* Interpreter to send results back to */
    1126     const char *switchName,     /* Not used. */
    1127     Tcl_Obj *objPtr,            /* String representation */
    1128     char *record,               /* Structure record */
    1129     int offset,                 /* Not used. */
    1130     int flags)                  /* Not used. */
     1123    ClientData clientData,        /* Flag indicating if the node is considered
     1124                                * before or after the insertion position. */
     1125    Tcl_Interp *interp,                /* Interpreter to send results back to */
     1126    const char *switchName,        /* Not used. */
     1127    Tcl_Obj *objPtr,                /* String representation */
     1128    char *record,                /* Structure record */
     1129    int offset,                        /* Not used. */
     1130    int flags)                        /* Not used. */
    11311131{
    11321132    const char *string = Tcl_GetString(objPtr);
    11331133    if (string[1] == '\0') {
    1134         FlowCmd::SliceAxis *axisPtr = (FlowCmd::SliceAxis *)(record + offset);
     1134        FlowCmd::SliceAxis *axisPtr = (FlowCmd::SliceAxis *)(record + offset);
    11351135        char c;
    11361136        c = tolower((unsigned char)string[0]);
     
    11571157 * ColorSwitchProc --
    11581158 *
    1159  *      Convert a Tcl_Obj representing the label of a list of four color
    1160  *      components in to a RGBA color value.
     1159 *        Convert a Tcl_Obj representing the label of a list of four color
     1160 *        components in to a RGBA color value.
    11611161 *
    11621162 * Results:
    1163  *      The return value is a standard Tcl result.
     1163 *        The return value is a standard Tcl result.
    11641164 *
    11651165 *---------------------------------------------------------------------------
     
    11681168static int
    11691169ColorSwitchProc(
    1170     ClientData clientData,      /* Flag indicating if the node is considered
    1171                                 * before or after the insertion position. */
    1172     Tcl_Interp *interp,         /* Interpreter to send results back to */
    1173     const char *switchName,     /* Not used. */
    1174     Tcl_Obj *objPtr,            /* String representation */
    1175     char *record,               /* Structure record */
    1176     int offset,                 /* Not used. */
    1177     int flags)                  /* Not used. */
     1170    ClientData clientData,        /* Flag indicating if the node is considered
     1171                                * before or after the insertion position. */
     1172    Tcl_Interp *interp,                /* Interpreter to send results back to */
     1173    const char *switchName,        /* Not used. */
     1174    Tcl_Obj *objPtr,                /* String representation */
     1175    char *record,                /* Structure record */
     1176    int offset,                        /* Not used. */
     1177    int flags)                        /* Not used. */
    11781178{
    11791179    Tcl_Obj **objv;
     
    11821182
    11831183    if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
    1184         return TCL_ERROR;
     1184        return TCL_ERROR;
    11851185    }
    11861186    if ((objc < 3) || (objc > 4)) {
    1187         Tcl_AppendResult(interp, "wrong # of elements in color definition",
    1188                         (char *)NULL);
    1189         return TCL_ERROR;
     1187        Tcl_AppendResult(interp, "wrong # of elements in color definition",
     1188                        (char *)NULL);
     1189        return TCL_ERROR;
    11901190    }
    11911191    float values[4];
     
    11931193    values[3] = 1.0f;
    11941194    for (i = 0; i < objc; i++) {
    1195         float value;
    1196 
    1197         if (GetFloatFromObj(interp, objv[i], &value) != TCL_OK) {
    1198             return TCL_ERROR;
    1199         }
    1200         if ((value < 0.0) || (value > 1.0)) {
    1201             Tcl_AppendResult(interp, "bad component value in \"",
    1202                 Tcl_GetString(objPtr), "\": color values must be [0..1]",
    1203                 (char *)NULL);
    1204             return TCL_ERROR;
    1205         }
    1206         values[i] = value;
    1207     }      
     1195        float value;
     1196
     1197        if (GetFloatFromObj(interp, objv[i], &value) != TCL_OK) {
     1198            return TCL_ERROR;
     1199        }
     1200        if ((value < 0.0) || (value > 1.0)) {
     1201            Tcl_AppendResult(interp, "bad component value in \"",
     1202                Tcl_GetString(objPtr), "\": color values must be [0..1]",
     1203                (char *)NULL);
     1204            return TCL_ERROR;
     1205        }
     1206        values[i] = value;
     1207    }           
    12081208    colorPtr->r = values[0];
    12091209    colorPtr->g = values[1];
     
    12181218 * PointSwitchProc --
    12191219 *
    1220  *      Convert a Tcl_Obj representing the a 3-D coordinate into
    1221  *      a point.
     1220 *        Convert a Tcl_Obj representing the a 3-D coordinate into
     1221 *        a point.
    12221222 *
    12231223 * Results:
    1224  *      The return value is a standard Tcl result.
     1224 *        The return value is a standard Tcl result.
    12251225 *
    12261226 *---------------------------------------------------------------------------
     
    12291229static int
    12301230PointSwitchProc(
    1231     ClientData clientData,      /* Flag indicating if the node is considered
    1232                                 * before or after the insertion position. */
    1233     Tcl_Interp *interp,         /* Interpreter to send results back to */
    1234     const char *switchName,     /* Not used. */
    1235     Tcl_Obj *objPtr,            /* String representation */
    1236     char *record,               /* Structure record */
    1237     int offset,                 /* Not used. */
    1238     int flags)                  /* Not used. */
     1231    ClientData clientData,        /* Flag indicating if the node is considered
     1232                                * before or after the insertion position. */
     1233    Tcl_Interp *interp,                /* Interpreter to send results back to */
     1234    const char *switchName,        /* Not used. */
     1235    Tcl_Obj *objPtr,                /* String representation */
     1236    char *record,                /* Structure record */
     1237    int offset,                        /* Not used. */
     1238    int flags)                        /* Not used. */
    12391239{
    12401240    FlowPoint *pointPtr = (FlowPoint *)(record + offset);
     
    12431243
    12441244    if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
    1245         return TCL_ERROR;
     1245        return TCL_ERROR;
    12461246    }
    12471247    if (objc != 3) {
    1248         Tcl_AppendResult(interp, "wrong # of elements for box coordinates: "
    1249                         " should be \"x y z\"", (char *)NULL);
    1250         return TCL_ERROR;
     1248        Tcl_AppendResult(interp, "wrong # of elements for box coordinates: "
     1249                        " should be \"x y z\"", (char *)NULL);
     1250        return TCL_ERROR;
    12511251    }
    12521252    float values[3];
    12531253    int i;
    12541254    for (i = 0; i < objc; i++) {
    1255         float value;
    1256 
    1257         if (GetFloatFromObj(interp, objv[i], &value) != TCL_OK) {
    1258             return TCL_ERROR;
    1259         }
    1260         values[i] = value;
    1261     }      
     1255        float value;
     1256
     1257        if (GetFloatFromObj(interp, objv[i], &value) != TCL_OK) {
     1258            return TCL_ERROR;
     1259        }
     1260        values[i] = value;
     1261    }           
    12621262    pointPtr->x = values[0];
    12631263    pointPtr->y = values[1];
     
    12711271 * PositionSwitchProc --
    12721272 *
    1273  *      Convert a Tcl_Obj representing the a 3-D coordinate into
    1274  *      a point.
     1273 *        Convert a Tcl_Obj representing the a 3-D coordinate into
     1274 *        a point.
    12751275 *
    12761276 * Results:
    1277  *      The return value is a standard Tcl result.
     1277 *        The return value is a standard Tcl result.
    12781278 *
    12791279 *---------------------------------------------------------------------------
     
    12821282static int
    12831283PositionSwitchProc(
    1284     ClientData clientData,      /* Flag indicating if the node is considered
    1285                                 * before or after the insertion position. */
    1286     Tcl_Interp *interp,         /* Interpreter to send results back to */
    1287     const char *switchName,     /* Not used. */
    1288     Tcl_Obj *objPtr,            /* String representation */
    1289     char *record,               /* Structure record */
    1290     int offset,                 /* Not used. */
    1291     int flags)                  /* Not used. */
     1284    ClientData clientData,        /* Flag indicating if the node is considered
     1285                                * before or after the insertion position. */
     1286    Tcl_Interp *interp,                /* Interpreter to send results back to */
     1287    const char *switchName,        /* Not used. */
     1288    Tcl_Obj *objPtr,                /* String representation */
     1289    char *record,                /* Structure record */
     1290    int offset,                        /* Not used. */
     1291    int flags)                        /* Not used. */
    12921292{
    12931293    FlowPosition *posPtr = (FlowPosition *)(record + offset);
     
    12981298    p = strrchr((char *)string, '%');
    12991299    if (p == NULL) {
    1300         float value;
    1301 
    1302         if (GetFloatFromObj(interp, objPtr, &value) != TCL_OK) {
    1303             return TCL_ERROR;
    1304         }
    1305         posPtr->value = value;
    1306         posPtr->flags = ABSPOS;
     1300        float value;
     1301
     1302        if (GetFloatFromObj(interp, objPtr, &value) != TCL_OK) {
     1303            return TCL_ERROR;
     1304        }
     1305        posPtr->value = value;
     1306        posPtr->flags = ABSPOS;
    13071307    } else {
    1308         double value;
    1309 
    1310         *p = '\0';
    1311         if (Tcl_GetDouble(interp, string, &value) != TCL_OK) {
    1312             return TCL_ERROR;
    1313         }
    1314         posPtr->value = (float)value * 0.01;
    1315         posPtr->flags = RELPOS;
     1308        double value;
     1309
     1310        *p = '\0';
     1311        if (Tcl_GetDouble(interp, string, &value) != TCL_OK) {
     1312            return TCL_ERROR;
     1313        }
     1314        posPtr->value = (float)value * 0.01;
     1315        posPtr->flags = RELPOS;
    13161316    }
    13171317    return TCL_OK;
     
    13231323 * TransferFunctionSwitchProc --
    13241324 *
    1325  *      Convert a Tcl_Obj representing the transfer function into a
    1326  *      TransferFunction pointer.  The transfer function must have been
    1327  *      previously defined.
     1325 *        Convert a Tcl_Obj representing the transfer function into a
     1326 *        TransferFunction pointer.  The transfer function must have been
     1327 *        previously defined.
    13281328 *
    13291329 * Results:
    1330  *      The return value is a standard Tcl result.
     1330 *        The return value is a standard Tcl result.
    13311331 *
    13321332 *---------------------------------------------------------------------------
     
    13351335static int
    13361336TransferFunctionSwitchProc(
    1337     ClientData clientData,      /* Flag indicating if the node is considered
    1338                                 * before or after the insertion position. */
    1339     Tcl_Interp *interp,         /* Interpreter to send results back to */
    1340     const char *switchName,     /* Not used. */
    1341     Tcl_Obj *objPtr,            /* String representation */
    1342     char *record,               /* Structure record */
    1343     int offset,                 /* Not used. */
    1344     int flags)                  /* Not used. */
     1337    ClientData clientData,        /* Flag indicating if the node is considered
     1338                                * before or after the insertion position. */
     1339    Tcl_Interp *interp,                /* Interpreter to send results back to */
     1340    const char *switchName,        /* Not used. */
     1341    Tcl_Obj *objPtr,                /* String representation */
     1342    char *record,                /* Structure record */
     1343    int offset,                        /* Not used. */
     1344    int flags)                        /* Not used. */
    13451345{
    13461346    TransferFunction **funcPtrPtr = (TransferFunction **)(record + offset);
     
    13611361 * VideoFormatSwitchProc --
    13621362 *
    1363  *      Convert a Tcl_Obj representing the video format into its
    1364  *      integer id.
     1363 *        Convert a Tcl_Obj representing the video format into its
     1364 *        integer id.
    13651365 *
    13661366 * Results:
    1367  *      The return value is a standard Tcl result.
     1367 *        The return value is a standard Tcl result.
    13681368 *
    13691369 *---------------------------------------------------------------------------
     
    13721372static int
    13731373VideoFormatSwitchProc(
    1374     ClientData clientData,      /* Not used. */
    1375     Tcl_Interp *interp,         /* Interpreter to send results back to */
    1376     const char *switchName,     /* Not used. */
    1377     Tcl_Obj *objPtr,            /* String representation */
    1378     char *record,               /* Structure record */
    1379     int offset,                 /* Not used. */
    1380     int flags)                  /* Not used. */
     1374    ClientData clientData,        /* Not used. */
     1375    Tcl_Interp *interp,                /* Interpreter to send results back to */
     1376    const char *switchName,        /* Not used. */
     1377    Tcl_Obj *objPtr,                /* String representation */
     1378    char *record,                /* Structure record */
     1379    int offset,                        /* Not used. */
     1380    int flags)                        /* Not used. */
    13811381{
    13821382    Rappture::AVTranslate::VideoFormats *formatPtr =
    1383         (Rappture::AVTranslate::VideoFormats *)(record + offset);
     1383        (Rappture::AVTranslate::VideoFormats *)(record + offset);
    13841384    const char *string;
    13851385    char c;
     
    13881388    c = string[0];
    13891389    if ((c == 'm') && (strcmp(string, "mpeg") == 0)) {
    1390         *formatPtr =  Rappture::AVTranslate::MPEG1;
     1390        *formatPtr =  Rappture::AVTranslate::MPEG1;
    13911391    } else if ((c == 't') && (strcmp(string, "theora") == 0)) {
    1392         *formatPtr = Rappture::AVTranslate::THEORA;
     1392        *formatPtr = Rappture::AVTranslate::THEORA;
    13931393    } else if ((c == 'm') && (strcmp(string, "mov") == 0)) {
    1394         *formatPtr = Rappture::AVTranslate::QUICKTIME;
     1394        *formatPtr = Rappture::AVTranslate::QUICKTIME;
    13951395    } else {
    1396         Tcl_AppendResult(interp, "bad video format \"", string,
     1396        Tcl_AppendResult(interp, "bad video format \"", string,
    13971397                     "\": should be mpeg, theora, or mov", (char*)NULL);
    13981398    }
     
    14021402static int
    14031403FlowConfigureOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1404                 Tcl_Obj *const *objv)
     1404                Tcl_Obj *const *objv)
    14051405{
    14061406    FlowCmd *flowPtr = (FlowCmd *)clientData;
    14071407
    14081408    if (flowPtr->ParseSwitches(interp, objc - 2, objv + 2) != TCL_OK) {
    1409         return TCL_ERROR;
     1409        return TCL_ERROR;
    14101410    }
    14111411    NanoVis::EventuallyRedraw(NanoVis::MAP_FLOWS);
     
    14151415static int
    14161416FlowParticlesAddOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1417                    Tcl_Obj *const *objv)
     1417                   Tcl_Obj *const *objv)
    14181418{
    14191419    FlowCmd *flowPtr = (FlowCmd *)clientData;
    14201420
    14211421    if (flowPtr->CreateParticles(interp, objv[3]) != TCL_OK) {
    1422         return TCL_ERROR;
     1422        return TCL_ERROR;
    14231423    }
    14241424    FlowParticles *particlesPtr;
    14251425    if (flowPtr->GetParticles(interp, objv[3], &particlesPtr) != TCL_OK) {
    1426         return TCL_ERROR;
     1426        return TCL_ERROR;
    14271427    }
    14281428    if (particlesPtr->ParseSwitches(interp, objc - 4, objv + 4) != TCL_OK) {
    1429         delete particlesPtr;
    1430         return TCL_ERROR;
     1429        delete particlesPtr;
     1430        return TCL_ERROR;
    14311431    }
    14321432    particlesPtr->Configure();
     
    14381438static int
    14391439FlowParticlesConfigureOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1440                         Tcl_Obj *const *objv)
     1440                        Tcl_Obj *const *objv)
    14411441{
    14421442    FlowCmd *flowPtr = (FlowCmd *)clientData;
     
    14441444    FlowParticles *particlesPtr;
    14451445    if (flowPtr->GetParticles(interp, objv[3], &particlesPtr) != TCL_OK) {
    1446         return TCL_ERROR;
     1446        return TCL_ERROR;
    14471447    }
    14481448    if (particlesPtr->ParseSwitches(interp, objc - 4, objv + 4) != TCL_OK) {
    1449         return TCL_ERROR;
     1449        return TCL_ERROR;
    14501450    }
    14511451    particlesPtr->Configure();
     
    14561456static int
    14571457FlowParticlesDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1458                       Tcl_Obj *const *objv)
     1458                      Tcl_Obj *const *objv)
    14591459{
    14601460    FlowCmd *flowPtr = (FlowCmd *)clientData;
    14611461    int i;
    14621462    for (i = 3; i < objc; i++) {
    1463         FlowParticles *particlesPtr;
    1464 
    1465         if (flowPtr->GetParticles(NULL, objv[i], &particlesPtr) == TCL_OK) {
    1466             delete particlesPtr;
    1467         }
     1463        FlowParticles *particlesPtr;
     1464
     1465        if (flowPtr->GetParticles(NULL, objv[i], &particlesPtr) == TCL_OK) {
     1466            delete particlesPtr;
     1467        }
    14681468    }
    14691469    NanoVis::EventuallyRedraw();
     
    14731473static int
    14741474FlowParticlesNamesOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1475                      Tcl_Obj *const *objv)
     1475                     Tcl_Obj *const *objv)
    14761476{
    14771477    FlowCmd *flowPtr = (FlowCmd *)clientData;
     
    14811481    FlowParticles *particlesPtr;
    14821482    for (particlesPtr = flowPtr->FirstParticles(&iter); particlesPtr != NULL;
    1483         particlesPtr = flowPtr->NextParticles(&iter)) {
    1484         Tcl_Obj *objPtr;
    1485 
    1486         objPtr = Tcl_NewStringObj(particlesPtr->name(), -1);
    1487         Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
     1483        particlesPtr = flowPtr->NextParticles(&iter)) {
     1484        Tcl_Obj *objPtr;
     1485
     1486        objPtr = Tcl_NewStringObj(particlesPtr->name(), -1);
     1487        Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
    14881488    }
    14891489    Tcl_SetObjResult(interp, listObjPtr);
     
    14961496 * FlowParticlesObjCmd --
    14971497 *
    1498  *      This procedure is invoked to process commands on behalf of the flow
    1499  *      object.
     1498 *         This procedure is invoked to process commands on behalf of the flow
     1499 *         object.
    15001500 *
    15011501 * Results:
    1502  *      A standard Tcl result.
     1502 *        A standard Tcl result.
    15031503 *
    15041504 * Side effects:
    1505  *      See the user documentation.
     1505 *        See the user documentation.
    15061506 *
    15071507 * $flow particles oper $name
     
    15111511    {"add",        1, FlowParticlesAddOp,        4, 0, "name ?switches?",},
    15121512    {"configure",  1, FlowParticlesConfigureOp,  4, 0, "name ?switches?",},
    1513     {"delete",     1, FlowParticlesDeleteOp,     4, 0, "?name...?"},
     1513    {"delete",           1, FlowParticlesDeleteOp,     4, 0, "?name...?"},
    15141514    {"names",      1, FlowParticlesNamesOp,      3, 4, "?pattern?"},
    15151515};
     
    15191519static int
    15201520FlowParticlesOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1521                Tcl_Obj *const *objv)
     1521               Tcl_Obj *const *objv)
    15221522{
    15231523    Tcl_ObjCmdProc *proc;
    15241524    proc = Rappture::GetOpFromObj(interp, nFlowParticlesOps, flowParticlesOps,
    1525         Rappture::CMDSPEC_ARG2, objc, objv, 0);
     1525        Rappture::CMDSPEC_ARG2, objc, objv, 0);
    15261526    if (proc == NULL) {
    1527         return TCL_ERROR;
     1527        return TCL_ERROR;
    15281528    }
    15291529    FlowCmd *flowPtr = (FlowCmd *)clientData;
     
    15371537static int
    15381538FlowBoxAddOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1539                Tcl_Obj *const *objv)
     1539               Tcl_Obj *const *objv)
    15401540{
    15411541    FlowCmd *flowPtr = (FlowCmd *)clientData;
    15421542
    15431543    if (flowPtr->CreateBox(interp, objv[3]) != TCL_OK) {
    1544         return TCL_ERROR;
     1544        return TCL_ERROR;
    15451545    }
    15461546    FlowBox *boxPtr;
    15471547    if (flowPtr->GetBox(interp, objv[3], &boxPtr) != TCL_OK) {
    1548         return TCL_ERROR;
     1548        return TCL_ERROR;
    15491549    }
    15501550    if (boxPtr->ParseSwitches(interp, objc - 4, objv + 4) != TCL_OK) {
    1551         delete boxPtr;
    1552         return TCL_ERROR;
     1551        delete boxPtr;
     1552        return TCL_ERROR;
    15531553    }
    15541554    NanoVis::EventuallyRedraw();
     
    15591559static int
    15601560FlowBoxDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1561                    Tcl_Obj *const *objv)
     1561                   Tcl_Obj *const *objv)
    15621562{
    15631563    FlowCmd *flowPtr = (FlowCmd *)clientData;
    15641564    int i;
    15651565    for (i = 3; i < objc; i++) {
    1566         FlowBox *boxPtr;
    1567 
    1568         if (flowPtr->GetBox(NULL, objv[i], &boxPtr) == TCL_OK) {
    1569             delete boxPtr;
    1570         }
     1566        FlowBox *boxPtr;
     1567
     1568        if (flowPtr->GetBox(NULL, objv[i], &boxPtr) == TCL_OK) {
     1569            delete boxPtr;
     1570        }
    15711571    }
    15721572    NanoVis::EventuallyRedraw();
     
    15841584    FlowBox *boxPtr;
    15851585    for (boxPtr = flowPtr->FirstBox(&iter); boxPtr != NULL;
    1586         boxPtr = flowPtr->NextBox(&iter)) {
    1587         Tcl_Obj *objPtr;
    1588 
    1589         objPtr = Tcl_NewStringObj(boxPtr->name(), -1);
    1590         Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
     1586        boxPtr = flowPtr->NextBox(&iter)) {
     1587        Tcl_Obj *objPtr;
     1588
     1589        objPtr = Tcl_NewStringObj(boxPtr->name(), -1);
     1590        Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
    15911591    }
    15921592    Tcl_SetObjResult(interp, listObjPtr);
     
    15961596static int
    15971597FlowBoxConfigureOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1598                         Tcl_Obj *const *objv)
     1598                        Tcl_Obj *const *objv)
    15991599{
    16001600    FlowCmd *flowPtr = (FlowCmd *)clientData;
     
    16021602    FlowBox *boxPtr;
    16031603    if (flowPtr->GetBox(interp, objv[3], &boxPtr) != TCL_OK) {
    1604         return TCL_ERROR;
     1604        return TCL_ERROR;
    16051605    }
    16061606    if (boxPtr->ParseSwitches(interp, objc - 4, objv + 4) != TCL_OK) {
    1607         return TCL_ERROR;
     1607        return TCL_ERROR;
    16081608    }
    16091609    NanoVis::EventuallyRedraw();
     
    16161616 * FlowBoxOp--
    16171617 *
    1618  *      This procedure is invoked to process commands on behalf of the flow
    1619  *      object.
     1618 *         This procedure is invoked to process commands on behalf of the flow
     1619 *         object.
    16201620 *
    16211621 * Results:
    1622  *      A standard Tcl result.
     1622 *        A standard Tcl result.
    16231623 *
    16241624 * Side effects:
    1625  *      See the user documentation.
     1625 *        See the user documentation.
    16261626 *
    16271627 *---------------------------------------------------------------------------
     
    16301630    {"add",        1, FlowBoxAddOp,        4, 0, "name ?switches?",},
    16311631    {"configure",  1, FlowBoxConfigureOp,  4, 0, "name ?switches?",},
    1632     {"delete",     1, FlowBoxDeleteOp,     3, 0, "?name...?"},
     1632    {"delete",           1, FlowBoxDeleteOp,     3, 0, "?name...?"},
    16331633    {"names",      1, FlowBoxNamesOp,      3, 0, "?pattern?"},
    16341634};
     
    16381638static int
    16391639FlowBoxOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1640                Tcl_Obj *const *objv)
     1640               Tcl_Obj *const *objv)
    16411641{
    16421642    Tcl_ObjCmdProc *proc;
    16431643    proc = Rappture::GetOpFromObj(interp, nFlowBoxOps, flowBoxOps,
    1644         Rappture::CMDSPEC_ARG2, objc, objv, 0);
     1644        Rappture::CMDSPEC_ARG2, objc, objv, 0);
    16451645    if (proc == NULL) {
    1646         return TCL_ERROR;
     1646        return TCL_ERROR;
    16471647    }
    16481648    FlowCmd *flowPtr = (FlowCmd *)clientData;
     
    16671667static int
    16681668FlowLegendOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1669           Tcl_Obj *const *objv)
     1669          Tcl_Obj *const *objv)
    16701670{
    16711671    FlowCmd *flowPtr = (FlowCmd *)clientData;
     
    16981698 * FlowInstObjCmd --
    16991699 *
    1700  *      This procedure is invoked to process commands on behalf of the flow
    1701  *      object.
     1700 *         This procedure is invoked to process commands on behalf of the flow
     1701 *         object.
    17021702 *
    17031703 * Results:
    1704  *      A standard Tcl result.
     1704 *        A standard Tcl result.
    17051705 *
    17061706 * Side effects:
    1707  *      See the user documentation.
     1707 *        See the user documentation.
    17081708 *
    17091709 *---------------------------------------------------------------------------
     
    17121712    {"box",         1, FlowBoxOp,        2, 0, "oper ?args?"},
    17131713    {"configure",   1, FlowConfigureOp,  2, 0, "?switches?"},
    1714     {"data",        1, FlowDataOp,       2, 0, "oper ?args?"},
     1714    {"data",            1, FlowDataOp,       2, 0, "oper ?args?"},
    17151715    {"legend",      1, FlowLegendOp,     4, 4, "w h"},
    17161716    {"particles",   1, FlowParticlesOp,  2, 0, "oper ?args?"}
     
    17201720static int
    17211721FlowInstObjCmd(ClientData clientData, Tcl_Interp *interp, int objc,
    1722                Tcl_Obj *const *objv)
     1722               Tcl_Obj *const *objv)
    17231723{
    17241724    Tcl_ObjCmdProc *proc;
    17251725    proc = Rappture::GetOpFromObj(interp, nFlowInstOps, flowInstOps,
    1726         Rappture::CMDSPEC_ARG1, objc, objv, 0);
     1726        Rappture::CMDSPEC_ARG1, objc, objv, 0);
    17271727    if (proc == NULL) {
    1728         return TCL_ERROR;
     1728        return TCL_ERROR;
    17291729    }
    17301730    assert(CheckGL(AT));
     
    17421742 * FlowInstDeleteProc --
    17431743 *
    1744  *      Deletes the command associated with the tree.  This is called only
    1745  *      when the command associated with the tree is destroyed.
     1744 *        Deletes the command associated with the tree.  This is called only
     1745 *        when the command associated with the tree is destroyed.
    17461746 *
    17471747 * Results:
    1748  *      None.
     1748 *        None.
    17491749 *
    17501750 *---------------------------------------------------------------------------
     
    17671767static int
    17681768FlowAddOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1769           Tcl_Obj *const *objv)
     1769          Tcl_Obj *const *objv)
    17701770{
    17711771    if (NanoVis::CreateFlow(interp, objv[2]) != TCL_OK) {
    1772         return TCL_ERROR;
     1772        return TCL_ERROR;
    17731773    }
    17741774    FlowCmd *flowPtr;
    17751775    if (NanoVis::GetFlow(interp, objv[2], &flowPtr) != TCL_OK) {
    1776         return TCL_ERROR;
     1776        return TCL_ERROR;
    17771777    }
    17781778    if (flowPtr->ParseSwitches(interp, objc - 3, objv + 3) != TCL_OK) {
    1779         Tcl_DeleteCommand(interp, flowPtr->name());
    1780         return TCL_ERROR;
     1779        Tcl_DeleteCommand(interp, flowPtr->name());
     1780        return TCL_ERROR;
    17811781    }
    17821782    Tcl_SetObjResult(interp, objv[2]);
     
    17951795static int
    17961796FlowDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1797              Tcl_Obj *const *objv)
     1797             Tcl_Obj *const *objv)
    17981798{
    17991799    int i;
    18001800
    18011801    for (i = 2; i < objc; i++) {
    1802         FlowCmd *flowPtr;
    1803 
    1804         if (NanoVis::GetFlow(interp, objv[i], &flowPtr) != TCL_OK) {
    1805             return TCL_ERROR;
    1806         }
    1807         Tcl_DeleteCommand(interp, flowPtr->name());
     1802        FlowCmd *flowPtr;
     1803
     1804        if (NanoVis::GetFlow(interp, objv[i], &flowPtr) != TCL_OK) {
     1805            return TCL_ERROR;
     1806        }
     1807        Tcl_DeleteCommand(interp, flowPtr->name());
    18081808    }
    18091809    NanoVis::EventuallyRedraw(NanoVis::MAP_FLOWS);
     
    18211821static int
    18221822FlowExistsOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1823              Tcl_Obj *const *objv)
     1823             Tcl_Obj *const *objv)
    18241824{
    18251825    bool value;
     
    18281828    value = false;
    18291829    if (NanoVis::GetFlow(NULL, objv[2], &flowPtr) == TCL_OK) {
    1830         value = true;
     1830        value = true;
    18311831    }
    18321832    Tcl_SetBooleanObj(Tcl_GetObjResult(interp), (int)value);
     
    18391839 * FlowGotoOp --
    18401840 *
    1841  *      flow goto number
     1841 *        flow goto number
    18421842 *
    18431843 *---------------------------------------------------------------------------
     
    18521852    }
    18531853    if ((nSteps < 0) || (nSteps > SHRT_MAX)) {
    1854         Tcl_AppendResult(interp, "flow goto: bad # of steps \"",
    1855                         Tcl_GetString(objv[2]), "\"", (char *)NULL);
    1856         return TCL_ERROR;
     1854        Tcl_AppendResult(interp, "flow goto: bad # of steps \"",
     1855                        Tcl_GetString(objv[2]), "\"", (char *)NULL);
     1856        return TCL_ERROR;
    18571857    }
    18581858    NanoVis::ResetFlows();
    18591859    if (NanoVis::flags & NanoVis::MAP_FLOWS) {
    1860         NanoVis::MapFlows();
     1860        NanoVis::MapFlows();
    18611861    }
    18621862    int i;
    18631863    NanoVis::AdvectFlows();
    18641864    for (i = 0; i < nSteps; i++) {
    1865         if (NanoVis::licRenderer->active()) {
    1866             NanoVis::licRenderer->convolve();
    1867         }
    1868         NanoVis::AdvectFlows();
     1865        if (NanoVis::licRenderer->active()) {
     1866            NanoVis::licRenderer->convolve();
     1867        }
     1868        NanoVis::AdvectFlows();
    18691869    }
    18701870    NanoVis::EventuallyRedraw();
     
    18821882static int
    18831883FlowNamesOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1884             Tcl_Obj *const *objv)
     1884            Tcl_Obj *const *objv)
    18851885{
    18861886    Tcl_Obj *listObjPtr;
     
    18891889    FlowIterator iter;
    18901890    for (flowPtr = NanoVis::FirstFlow(&iter); flowPtr != NULL;
    1891         flowPtr = NanoVis::NextFlow(&iter)) {
    1892         Tcl_Obj *objPtr;
    1893 
    1894         objPtr = Tcl_NewStringObj(flowPtr->name(), -1);
    1895         Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
     1891        flowPtr = NanoVis::NextFlow(&iter)) {
     1892        Tcl_Obj *objPtr;
     1893
     1894        objPtr = Tcl_NewStringObj(flowPtr->name(), -1);
     1895        Tcl_ListObjAppendElement(interp, listObjPtr, objPtr);
    18961896    }
    18971897    Tcl_SetObjResult(interp, listObjPtr);
     
    19051905    assert(NanoVis::licRenderer != NULL);
    19061906    if (NanoVis::flags & NanoVis::MAP_FLOWS) {
    1907         NanoVis::MapFlows();
     1907        NanoVis::MapFlows();
    19081908    }
    19091909    NanoVis::EventuallyRedraw();
     
    19221922
    19231923struct FlowVideoValues {
    1924     float frameRate;                    /* Frame rate */
    1925     int bitRate;                        /* Video bitrate */
    1926     int width, height;                  /* Dimensions of video frame. */
     1924    float frameRate;                        /* Frame rate */
     1925    int bitRate;                        /* Video bitrate */
     1926    int width, height;                        /* Dimensions of video frame. */
    19271927    int nFrames;
    19281928    Rappture::AVTranslate::VideoFormats format;
     
    19361936Rappture::SwitchSpec FlowCmd::videoSwitches[] = {
    19371937    {Rappture::SWITCH_FLOAT, "-bitrate", "value",
    1938         offsetof(FlowVideoValues, bitRate), 0},
     1938        offsetof(FlowVideoValues, bitRate), 0},
    19391939    {Rappture::SWITCH_CUSTOM, "-format", "string",
    19401940        offsetof(FlowVideoValues, format), 0, 0, &videoFormatSwitch},
    19411941    {Rappture::SWITCH_FLOAT, "-framerate", "value",
    1942         offsetof(FlowVideoValues, frameRate), 0},
     1942        offsetof(FlowVideoValues, frameRate), 0},
    19431943    {Rappture::SWITCH_INT, "-height", "integer",
    1944         offsetof(FlowVideoValues, height), 0},
     1944        offsetof(FlowVideoValues, height), 0},
    19451945    {Rappture::SWITCH_INT, "-numframes", "count",
    1946         offsetof(FlowVideoValues, nFrames), 0},
     1946        offsetof(FlowVideoValues, nFrames), 0},
    19471947    {Rappture::SWITCH_INT, "-width", "integer",
    1948         offsetof(FlowVideoValues, width), 0},
     1948        offsetof(FlowVideoValues, width), 0},
    19491949    {Rappture::SWITCH_END}
    19501950};
     
    19521952static int
    19531953FlowVideoOp(ClientData clientData, Tcl_Interp *interp, int objc,
    1954             Tcl_Obj *const *objv)
     1954            Tcl_Obj *const *objv)
    19551955{
    19561956    struct pollfd pollResults;
     
    19601960    pollResults.events = POLLIN;
    19611961
    1962 #define PENDING_TIMEOUT         10  /* milliseconds. */
     1962#define PENDING_TIMEOUT                10  /* milliseconds. */
    19631963    timeout = PENDING_TIMEOUT;
    19641964
     
    19671967
    19681968    token = Tcl_GetString(objv[2]);
    1969     values.frameRate = 25.0f;           // Default frame rate 25 fps
    1970     values.bitRate = 6.0e+6f;           // Default video bit rate.
     1969    values.frameRate = 25.0f;                // Default frame rate 25 fps
     1970    values.bitRate = 6.0e+6f;                // Default video bit rate.
    19711971    values.width = NanoVis::win_width;
    19721972    values.height = NanoVis::win_height;
     
    19741974    values.format = Rappture::AVTranslate::MPEG1;
    19751975    if (Rappture::ParseSwitches(interp, FlowCmd::videoSwitches,
    1976         objc - 3, objv + 3, &values, SWITCH_DEFAULTS) < 0) {
    1977         return TCL_ERROR;
     1976        objc - 3, objv + 3, &values, SWITCH_DEFAULTS) < 0) {
     1977        return TCL_ERROR;
    19781978    }
    19791979    if ((values.width < 0) || (values.width > SHRT_MAX) ||
    1980         (values.height < 0) || (values.height > SHRT_MAX)) {
    1981         Tcl_AppendResult(interp, "bad dimensions for video", (char *)NULL);
    1982         return TCL_ERROR;
     1980        (values.height < 0) || (values.height > SHRT_MAX)) {
     1981        Tcl_AppendResult(interp, "bad dimensions for video", (char *)NULL);
     1982        return TCL_ERROR;
    19831983    }
    19841984    if ((values.frameRate < 0.0f) || (values.frameRate > 30.0f)) {
    1985         Tcl_AppendResult(interp, "bad frame rate.", (char *)NULL);
    1986         return TCL_ERROR;
     1985        Tcl_AppendResult(interp, "bad frame rate.", (char *)NULL);
     1986        return TCL_ERROR;
    19871987    }
    19881988    if (values.bitRate < 0.0f) {
    1989         Tcl_AppendResult(interp, "bad bit rate.", (char *)NULL);
    1990         return TCL_ERROR;
     1989        Tcl_AppendResult(interp, "bad bit rate.", (char *)NULL);
     1990        return TCL_ERROR;
    19911991    }
    19921992    if (NanoVis::licRenderer == NULL) {
    1993         Tcl_AppendResult(interp, "no lic renderer.", (char *)NULL);
    1994         return TCL_ERROR;
     1993        Tcl_AppendResult(interp, "no lic renderer.", (char *)NULL);
     1994        return TCL_ERROR;
    19951995    }
    19961996    // Save the old dimensions of the offscreen buffer.
     
    20042004
    20052005    Rappture::AVTranslate movie(values.width, values.height, values.bitRate,
    2006         values.frameRate);
     2006        values.frameRate);
    20072007    char tmpFileName[200];
    20082008    sprintf(tmpFileName,"/tmp/flow%d.mpeg", getpid());
    20092009    if (!movie.init(context, tmpFileName)) {
    20102010        Tcl_AppendResult(interp, "can't initialized movie \"", tmpFileName,
    2011                 "\": ", context.remark(), (char *)NULL);
    2012         return TCL_ERROR;
     2011                "\": ", context.remark(), (char *)NULL);
     2012        return TCL_ERROR;
    20132013    }
    20142014    if ((values.width != oldWidth) || (values.height != oldHeight)) {
    2015         // Resize to the requested size.
    2016         NanoVis::resize_offscreen_buffer(values.width, values.height);
     2015        // Resize to the requested size.
     2016        NanoVis::resize_offscreen_buffer(values.width, values.height);
    20172017    }
    20182018    // Now compute the line padding for the offscreen buffer.
     
    20242024    bool canceled = false;
    20252025    for (int i = 1; i <= values.nFrames; i++) {
    2026         if (((i & 0xF) == 0) && (poll(&pollResults, 1, 0) > 0)) {
    2027             /* If there's another command on stdin, that means the client is
    2028              * trying to cancel this operation. */
    2029             canceled = true;
    2030             break;
    2031         }
    2032         if (NanoVis::licRenderer->active()) {
    2033             NanoVis::licRenderer->convolve();
    2034         }
    2035         NanoVis::AdvectFlows();
    2036         NanoVis::offscreen_buffer_capture();
     2026        if (((i & 0xF) == 0) && (poll(&pollResults, 1, 0) > 0)) {
     2027            /* If there's another command on stdin, that means the client is
     2028             * trying to cancel this operation. */
     2029            canceled = true;
     2030            break;
     2031        }
     2032        if (NanoVis::licRenderer->active()) {
     2033            NanoVis::licRenderer->convolve();
     2034        }
     2035        NanoVis::AdvectFlows();
     2036        NanoVis::offscreen_buffer_capture();
    20372037        NanoVis::display();
    20382038        NanoVis::read_screen();
     
    20432043    Trace("FLOW end\n");
    20442044    if (!canceled) {
    2045         Rappture::Buffer data;
    2046 
    2047         /* FIXME: find a way to get the data from the movie object as a
    2048         * void* */
    2049         if (!data.load(context, tmpFileName)) {
    2050             Tcl_AppendResult(interp, "can't load data from temporary file \"",
    2051                 tmpFileName, "\": ", context.remark(), (char *)NULL);
    2052             return TCL_ERROR;
    2053         }
    2054 
    2055         char command[200];
    2056         sprintf(command,"nv>image -bytes %lu -type movie -token \"%s\"\n",
    2057                 (unsigned long)data.size(), token);
    2058         NanoVis::sendDataToClient(command, data.bytes(), data.size());
     2045        Rappture::Buffer data;
     2046
     2047        /* FIXME: find a way to get the data from the movie object as a
     2048        * void* */
     2049        if (!data.load(context, tmpFileName)) {
     2050            Tcl_AppendResult(interp, "can't load data from temporary file \"",
     2051                tmpFileName, "\": ", context.remark(), (char *)NULL);
     2052            return TCL_ERROR;
     2053        }
     2054
     2055        char command[200];
     2056        sprintf(command,"nv>image -bytes %lu -type movie -token \"%s\"\n",
     2057                (unsigned long)data.size(), token);
     2058        NanoVis::sendDataToClient(command, data.bytes(), data.size());
    20592059    }
    20602060    if ((values.width != oldWidth) || (values.height != oldHeight)) {
    2061         NanoVis::resize_offscreen_buffer(oldWidth, oldHeight);
     2061        NanoVis::resize_offscreen_buffer(oldWidth, oldHeight);
    20622062    }
    20632063    NanoVis::ResetFlows();
    20642064    if (unlink(tmpFileName) != 0) {
    20652065        Tcl_AppendResult(interp, "can't unlink temporary movie file \"",
    2066                 tmpFileName, "\": ", Tcl_PosixError(interp), (char *)NULL);
    2067         return TCL_ERROR;
     2066                tmpFileName, "\": ", Tcl_PosixError(interp), (char *)NULL);
     2067        return TCL_ERROR;
    20682068    }
    20692069    return TCL_OK;
     
    20932093static int
    20942094FlowCmdProc(ClientData clientData, Tcl_Interp *interp, int objc,
    2095             Tcl_Obj *const *objv)
     2095            Tcl_Obj *const *objv)
    20962096{
    20972097    Tcl_ObjCmdProc *proc;
    20982098
    20992099    proc = Rappture::GetOpFromObj(interp, nFlowCmdOps, flowCmdOps,
    2100         Rappture::CMDSPEC_ARG1, objc, objv, 0);
     2100        Rappture::CMDSPEC_ARG1, objc, objv, 0);
    21012101    if (proc == NULL) {
    2102         return TCL_ERROR;
     2102        return TCL_ERROR;
    21032103    }
    21042104    return (*proc) (clientData, interp, objc, objv);
     
    21102110 * FlowCmdInitProc --
    21112111 *
    2112  *      This procedure is invoked to initialize the "tree" command.
     2112 *        This procedure is invoked to initialize the "tree" command.
    21132113 *
    21142114 * Results:
    2115  *      None.
     2115 *        None.
    21162116 *
    21172117 * Side effects:
    2118  *      Creates the new command and adds a new entry into a global Tcl
    2119  *      associative array.
     2118 *        Creates the new command and adds a new entry into a global Tcl
     2119 *        associative array.
    21202120 *
    21212121 *---------------------------------------------------------------------------
     
    21412141  if (line == endPtr) {
    21422142      vtkErrorMacro(<<"Premature EOF reading first line! " << " for file: "
    2143                     << (this->FileName?this->FileName:"(Null FileName)"));
     2143                    << (this->FileName?this->FileName:"(Null FileName)"));
    21442144      return false;
    21452145  }
    21462146  if (sscanf(line, "# vtk DataFile Version %s", version) != 1) {
    21472147      vtkErrorMacro(<< "Unrecognized file type: "<< line << " for file: "
    2148                     << (this->FileName?this->FileName:"(Null FileName)"));
     2148                    << (this->FileName?this->FileName:"(Null FileName)"));
    21492149      return false;
    21502150  }   
     
    21532153  if (line == endPtr) {
    21542154      vtkErrorMacro(<<"Premature EOF reading title! " << " for file: "
    2155                     << (this->FileName?this->FileName:"(Null FileName)"));
     2155                    << (this->FileName?this->FileName:"(Null FileName)"));
    21562156      return false;
    21572157  }
     
    21662166  if (line == endPtr) {
    21672167      vtkErrorMacro(<<"Premature EOF reading file type!" << " for file: "
    2168                     << (this->FileName?this->FileName:"(Null FileName)"));
     2168                    << (this->FileName?this->FileName:"(Null FileName)"));
    21692169      return false;
    21702170  }
     
    21762176  } else {
    21772177      vtkErrorMacro(<< "Unrecognized file type: "<< line << " for file: "
    2178                     << (this->FileName?this->FileName:"(Null FileName)"));
     2178                    << (this->FileName?this->FileName:"(Null FileName)"));
    21792179      _fileType = 0;
    21802180      return false;
     
    21852185  if (line == endPtr) {
    21862186      vtkErrorMacro(<<"Premature EOF reading file type!" << " for file: "
    2187                     << (this->FileName?this->FileName:"(Null FileName)"));
     2187                    << (this->FileName?this->FileName:"(Null FileName)"));
    21882188      return false;
    21892189  }
     
    21932193      line = getline(&p, endPtr);
    21942194      if (line == endPtr) {
    2195           // EOF
     2195          // EOF
    21962196      }
    21972197      type = GetWord(line, &endPtr);
    21982198      if (strncasecmp(word, "structured_grid", 15) == 0) {
    2199           vtkErrorMacro(<< "Cannot read dataset type: " << line);
    2200           return 1;
     2199          vtkErrorMacro(<< "Cannot read dataset type: " << line);
     2200          return 1;
    22012201      }
    22022202    // Read keyword and dimensions
  • trunk/packages/vizservers/nanovis/RpAVTranslate.h

    r1825 r1850  
    5353    size_t _height;
    5454    size_t _bitRate;
    55     float _frameRate;           // frames/seconds
     55    float _frameRate;                // frames/seconds
    5656    size_t _videoOutbufSize;
    5757    uint8_t *_videoOutbuf;
    5858
    5959    size_t width(void) {
    60         return _width;
     60        return _width;
    6161    }
    6262    void width(size_t width) {
    63         _width = width;
     63        _width = width;
    6464    }
    6565    size_t height(void) {
    66         return _width;
     66        return _width;
    6767    }
    6868    void height(size_t width) {
    69         _width = width;
     69        _width = width;
    7070    }
    7171    size_t bitRate(void) {
    72         return _bitRate;
     72        return _bitRate;
    7373    }
    7474    void bitRate(size_t bitRate) {
    75         _bitRate = bitRate;
     75        _bitRate = bitRate;
    7676    }
    7777    float frameRate(void) {
    78         return _frameRate;
     78        return _frameRate;
    7979    }
    8080    void frameRate(size_t frameRate) {
    81         _frameRate = frameRate;
     81        _frameRate = frameRate;
    8282    }
    8383    AVOutputFormat *_fmtPtr;
  • trunk/src/core/RpSimpleBuffer.h

    r1560 r1850  
    749749
    750750/**
    751  * Read data from the buffer into a memory location provided by caller
     751 * Move the internal position tracker to the beginning of the buffer.
    752752 */
    753753template<class T>
  • trunk/src/objects/RpMediaPlayer.cc

    r1848 r1850  
    218218
    219219                    // Save the frame to the SimpleBuffer object
    220                     __frame2ppm(b[frameCount]);
     220                    // FIXME:
     221                    // should be b[frameCount] but operator[] was
     222                    // overloaded in Rappture::SimpleBuffer, and I
     223                    // think it is causing problems
     224                    __frame2ppm(*b+frameCount);
    221225                    frameCount++;
    222226                }
Note: See TracChangeset for help on using the changeset viewer.