source: trunk/bindings/swig/nxexam.tcl @ 1822

Revision 211, 1.1 KB checked in by nexus, 9 years ago (diff)
  • Fixed a bug which caused foreign HDF-5's not to be read properly
  • Fixed a bug in NXgetnextentry which prevented reinitialising searches and nested searches.
  • Adapted the jnexus stuff to NAPI-2.0
  • Added the swig interface to NeXus to the source tree
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#--------------------------------------------------------------------------
2proc printDataset {ds} {
3    for {set i 0} {$i < [get-nxds-dim ds 0]} {incr i} {
4        puts stdout " "
5        for {set j 0} {$j < [get-nxds-dim ds 1]} {incr j} {
6            puts -nonewline stdout [format " %f" [get_nxds_value $ds $i $j]]
7        }
8    }
9    puts stdout "     "
10}
11#------------------------------------------------------------------------
12proc printAttributes {fd} {
13    set run 1
14    while {$run == 1} {
15        set entry [nx_getnextattr $fd / ]
16        if { [string length $entry] < 2 } {
17            set run 0
18            continue
19        } 
20        set list [split $entry /]
21        set atData [nx_getattr fd [lindex $list 0] \
22                [lindex $list 2] [lindex $list 1]]
23        puts stdout [format "%s = %s " [lindex $list 0] \
24                [get_nxds_text $atData]]
25        drop_nxds $atData
26    }
27}
28#----------------------------------------------------------------------
29set fd [nx_open "nxinter.hdf" $NXACC_READ]
30printAttributes $fd
31nx_opengroup $fd "fish" "NXentry"
32nx_opendata $fd "fish"
33set tata [nx_getdata $fd]
34printDataset $tata
35drop_nxds $tata
36nx_closedata $fd
37nx_closegroup $fd
38nx_close $fd
39
Note: See TracBrowser for help on using the repository browser.