summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/Debugger.py
blob: d4872ed42af8201de11c0b764e70cc243e7ba900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
import os
import bdb
import types
from tkinter import *
from idlelib.WindowList import ListedToplevel
from idlelib.ScrolledList import ScrolledList
from idlelib import macosxSupport


class Idb(bdb.Bdb):

    def __init__(self, gui):
        self.gui = gui
        bdb.Bdb.__init__(self)

    def user_line(self, frame):
        if self.in_rpc_code(frame):
            self.set_step()
            return
        message = self.__frame2message(frame)
        self.gui.interaction(message, frame)

    def user_exception(self, frame, info):
        if self.in_rpc_code(frame):
            self.set_step()
            return
        message = self.__frame2message(frame)
        self.gui.interaction(message, frame, info)

    def in_rpc_code(self, frame):
        if frame.f_code.co_filename.count('rpc.py'):
            return True
        else:
            prev_frame = frame.f_back
            if prev_frame.f_code.co_filename.count('Debugger.py'):
                # (that test will catch both Debugger.py and RemoteDebugger.py)
                return False
            return self.in_rpc_code(prev_frame)

    def __frame2message(self, frame):
        code = frame.f_code
        filename = code.co_filename
        lineno = frame.f_lineno
        basename = os.path.basename(filename)
        message = "%s:%s" % (basename, lineno)
        if code.co_name != "?":
            message = "%s: %s()" % (message, code.co_name)
        return message


class Debugger:

    vstack = vsource = vlocals = vglobals = None

    def __init__(self, pyshell, idb=None):
        if idb is None:
            idb = Idb(self)
        self.pyshell = pyshell
        self.idb = idb
        self.frame = None
        self.make_gui()
        self.interacting = 0

    def run(self, *args):
        try:
            self.interacting = 1
            return self.idb.run(*args)
        finally:
            self.interacting = 0

    def close(self, event=None):
        if self.interacting:
            self.top.bell()
            return
        if self.stackviewer:
            self.stackviewer.close(); self.stackviewer = None
        # Clean up pyshell if user clicked debugger control close widget.
        # (Causes a harmless extra cycle through close_debugger() if user
        # toggled debugger from pyshell Debug menu)
        self.pyshell.close_debugger()
        # Now close the debugger control window....
        self.top.destroy()

    def make_gui(self):
        pyshell = self.pyshell
        self.flist = pyshell.flist
        self.root = root = pyshell.root
        self.top = top = ListedToplevel(root)
        self.top.wm_title("Debug Control")
        self.top.wm_iconname("Debug")
        top.wm_protocol("WM_DELETE_WINDOW", self.close)
        self.top.bind("<Escape>", self.close)
        #
        self.bframe = bframe = Frame(top)
        self.bframe.pack(anchor="w")
        self.buttons = bl = []
        #
        self.bcont = b = Button(bframe, text="Go", command=self.cont)
        bl.append(b)
        self.bstep = b = Button(bframe, text="Step", command=self.step)
        bl.append(b)
        self.bnext = b = Button(bframe, text="Over", command=self.next)
        bl.append(b)
        self.bret = b = Button(bframe, text="Out", command=self.ret)
        bl.append(b)
        self.bret = b = Button(bframe, text="Quit", command=self.quit)
        bl.append(b)
        #
        for b in bl:
            b.configure(state="disabled")
            b.pack(side="left")
        #
        self.cframe = cframe = Frame(bframe)
        self.cframe.pack(side="left")
        #
        if not self.vstack:
            self.__class__.vstack = BooleanVar(top)
            self.vstack.set(1)
        self.bstack = Checkbutton(cframe,
            text="Stack", command=self.show_stack, variable=self.vstack)
        self.bstack.grid(row=0, column=0)
        if not self.vsource:
            self.__class__.vsource = BooleanVar(top)
        self.bsource = Checkbutton(cframe,
            text="Source", command=self.show_source, variable=self.vsource)
        self.bsource.grid(row=0, column=1)
        if not self.vlocals:
            self.__class__.vlocals = BooleanVar(top)
            self.vlocals.set(1)
        self.blocals = Checkbutton(cframe,
            text="Locals", command=self.show_locals, variable=self.vlocals)
        self.blocals.grid(row=1, column=0)
        if not self.vglobals:
            self.__class__.vglobals = BooleanVar(top)
        self.bglobals = Checkbutton(cframe,
            text="Globals", command=self.show_globals, variable=self.vglobals)
        self.bglobals.grid(row=1, column=1)
        #
        self.status = Label(top, anchor="w")
        self.status.pack(anchor="w")
        self.error = Label(top, anchor="w")
        self.error.pack(anchor="w", fill="x")
        self.errorbg = self.error.cget("background")
        #
        self.fstack = Frame(top, height=1)
        self.fstack.pack(expand=1, fill="both")
        self.flocals = Frame(top)
        self.flocals.pack(expand=1, fill="both")
        self.fglobals = Frame(top, height=1)
        self.fglobals.pack(expand=1, fill="both")
        #
        if self.vstack.get():
            self.show_stack()
        if self.vlocals.get():
            self.show_locals()
        if self.vglobals.get():
            self.show_globals()

    def interaction(self, message, frame, info=None):
        self.frame = frame
        self.status.configure(text=message)
        #
        if info:
            type, value, tb = info
            try:
                m1 = type.__name__
            except AttributeError:
                m1 = "%s" % str(type)
            if value is not None:
                try:
                    m1 = "%s: %s" % (m1, str(value))
                except:
                    pass
            bg = "yellow"
        else:
            m1 = ""
            tb = None
            bg = self.errorbg
        self.error.configure(text=m1, background=bg)
        #
        sv = self.stackviewer
        if sv:
            stack, i = self.idb.get_stack(self.frame, tb)
            sv.load_stack(stack, i)
        #
        self.show_variables(1)
        #
        if self.vsource.get():
            self.sync_source_line()
        #
        for b in self.buttons:
            b.configure(state="normal")
        #
        self.top.wakeup()
        self.root.mainloop()
        #
        for b in self.buttons:
            b.configure(state="disabled")
        self.status.configure(text="")
        self.error.configure(text="", background=self.errorbg)
        self.frame = None

    def sync_source_line(self):
        frame = self.frame
        if not frame:
            return
        filename, lineno = self.__frame2fileline(frame)
        if filename[:1] + filename[-1:] != "<>" and os.path.exists(filename):
            self.flist.gotofileline(filename, lineno)

    def __frame2fileline(self, frame):
        code = frame.f_code
        filename = code.co_filename
        lineno = frame.f_lineno
        return filename, lineno

    def cont(self):
        self.idb.set_continue()
        self.root.quit()

    def step(self):
        self.idb.set_step()
        self.root.quit()

    def next(self):
        self.idb.set_next(self.frame)
        self.root.quit()

    def ret(self):
        self.idb.set_return(self.frame)
        self.root.quit()

    def quit(self):
        self.idb.set_quit()
        self.root.quit()

    stackviewer = None

    def show_stack(self):
        if not self.stackviewer and self.vstack.get():
            self.stackviewer = sv = StackViewer(self.fstack, self.flist, self)
            if self.frame:
                stack, i = self.idb.get_stack(self.frame, None)
                sv.load_stack(stack, i)
        else:
            sv = self.stackviewer
            if sv and not self.vstack.get():
                self.stackviewer = None
                sv.close()
            self.fstack['height'] = 1

    def show_source(self):
        if self.vsource.get():
            self.sync_source_line()

    def show_frame(self, stackitem):
        self.frame = stackitem[0]  # lineno is stackitem[1]
        self.show_variables()

    localsviewer = None
    globalsviewer = None

    def show_locals(self):
        lv = self.localsviewer
        if self.vlocals.get():
            if not lv:
                self.localsviewer = NamespaceViewer(self.flocals, "Locals")
        else:
            if lv:
                self.localsviewer = None
                lv.close()
                self.flocals['height'] = 1
        self.show_variables()

    def show_globals(self):
        gv = self.globalsviewer
        if self.vglobals.get():
            if not gv:
                self.globalsviewer = NamespaceViewer(self.fglobals, "Globals")
        else:
            if gv:
                self.globalsviewer = None
                gv.close()
                self.fglobals['height'] = 1
        self.show_variables()

    def show_variables(self, force=0):
        lv = self.localsviewer
        gv = self.globalsviewer
        frame = self.frame
        if not frame:
            ldict = gdict = None
        else:
            ldict = frame.f_locals
            gdict = frame.f_globals
            if lv and gv and ldict is gdict:
                ldict = None
        if lv:
            lv.load_dict(ldict, force, self.pyshell.interp.rpcclt)
        if gv:
            gv.load_dict(gdict, force, self.pyshell.interp.rpcclt)

    def set_breakpoint_here(self, filename, lineno):
        self.idb.set_break(filename, lineno)

    def clear_breakpoint_here(self, filename, lineno):
        self.idb.clear_break(filename, lineno)

    def clear_file_breaks(self, filename):
        self.idb.clear_all_file_breaks(filename)

    def load_breakpoints(self):
        "Load PyShellEditorWindow breakpoints into subprocess debugger"
        for editwin in self.pyshell.flist.inversedict:
            filename = editwin.io.filename
            try:
                for lineno in editwin.breakpoints:
                    self.set_breakpoint_here(filename, lineno)
            except AttributeError:
                continue

class StackViewer(ScrolledList):

    def __init__(self, master, flist, gui):
        if macosxSupport.runningAsOSXApp():
            # At least on with the stock AquaTk version on OSX 10.4 you'll
            # get an shaking GUI that eventually kills IDLE if the width
            # argument is specified.
            ScrolledList.__init__(self, master)
        else:
            ScrolledList.__init__(self, master, width=80)
        self.flist = flist
        self.gui = gui
        self.stack = []

    def load_stack(self, stack, index=None):
        self.stack = stack
        self.clear()
        for i in range(len(stack)):
            frame, lineno = stack[i]
            try:
                modname = frame.f_globals["__name__"]
            except:
                modname = "?"
            code = frame.f_code
            filename = code.co_filename
            funcname = code.co_name
            import linecache
            sourceline = linecache.getline(filename, lineno)
            sourceline = sourceline.strip()
            if funcname in ("?", "", None):
                item = "%s, line %d: %s" % (modname, lineno, sourceline)
            else:
                item = "%s.%s(), line %d: %s" % (modname, funcname,
                                                 lineno, sourceline)
            if i == index:
                item = "> " + item
            self.append(item)
        if index is not None:
            self.select(index)

    def popup_event(self, event):
        "override base method"
        if self.stack:
            return ScrolledList.popup_event(self, event)

    def fill_menu(self):
        "override base method"
        menu = self.menu
        menu.add_command(label="Go to source line",
                         command=self.goto_source_line)
        menu.add_command(label="Show stack frame",
                         command=self.show_stack_frame)

    def on_select(self, index):
        "override base method"
        if 0 <= index < len(self.stack):
            self.gui.show_frame(self.stack[index])

    def on_double(self, index):
        "override base method"
        self.show_source(index)

    def goto_source_line(self):
        index = self.listbox.index("active")
        self.show_source(index)

    def show_stack_frame(self):
        index = self.listbox.index("active")
        if 0 <= index < len(self.stack):
            self.gui.show_frame(self.stack[index])

    def show_source(self, index):
        if not (0 <= index < len(self.stack)):
            return
        frame, lineno = self.stack[index]
        code = frame.f_code
        filename = code.co_filename
        if os.path.isfile(filename):
            edit = self.flist.open(filename)
            if edit:
                edit.gotoline(lineno)


class NamespaceViewer:

    def __init__(self, master, title, dict=None):
        width = 0
        height = 40
        if dict:
            height = 20*len(dict) # XXX 20 == observed height of Entry widget
        self.master = master
        self.title = title
        import reprlib
        self.repr = reprlib.Repr()
        self.repr.maxstring = 60
        self.repr.maxother = 60
        self.frame = frame = Frame(master)
        self.frame.pack(expand=1, fill="both")
        self.label = Label(frame, text=title, borderwidth=2, relief="groove")
        self.label.pack(fill="x")
        self.vbar = vbar = Scrollbar(frame, name="vbar")
        vbar.pack(side="right", fill="y")
        self.canvas = canvas = Canvas(frame,
                                      height=min(300, max(40, height)),
                                      scrollregion=(0, 0, width, height))
        canvas.pack(side="left", fill="both", expand=1)
        vbar["command"] = canvas.yview
        canvas["yscrollcommand"] = vbar.set
        self.subframe = subframe = Frame(canvas)
        self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw")
        self.load_dict(dict)

    dict = -1

    def load_dict(self, dict, force=0, rpc_client=None):
        if dict is self.dict and not force:
            return
        subframe = self.subframe
        frame = self.frame
        for c in list(subframe.children.values()):
            c.destroy()
        self.dict = None
        if not dict:
            l = Label(subframe, text="None")
            l.grid(row=0, column=0)
        else:
            #names = sorted(dict)
            ###
            # Because of (temporary) limitations on the dict_keys type (not yet
            # public or pickleable), have the subprocess to send a list of
            # keys, not a dict_keys object.  sorted() will take a dict_keys
            # (no subprocess) or a list.
            #
            # There is also an obscure bug in sorted(dict) where the
            # interpreter gets into a loop requesting non-existing dict[0],
            # dict[1], dict[2], etc from the RemoteDebugger.DictProxy.
            ###
            keys_list = dict.keys()
            names = sorted(keys_list)
            ###
            row = 0
            for name in names:
                value = dict[name]
                svalue = self.repr.repr(value) # repr(value)
                # Strip extra quotes caused by calling repr on the (already)
                # repr'd value sent across the RPC interface:
                if rpc_client:
                    svalue = svalue[1:-1]
                l = Label(subframe, text=name)
                l.grid(row=row, column=0, sticky="nw")
                l = Entry(subframe, width=0, borderwidth=0)
                l.insert(0, svalue)
                l.grid(row=row, column=1, sticky="nw")
                row = row+1
        self.dict = dict
        # XXX Could we use a <Configure> callback for the following?
        subframe.update_idletasks() # Alas!
        width = subframe.winfo_reqwidth()
        height = subframe.winfo_reqheight()
        canvas = self.canvas
        self.canvas["scrollregion"] = (0, 0, width, height)
        if height > 300:
            canvas["height"] = 300
            frame.pack(expand=1)
        else:
            canvas["height"] = height
            frame.pack(expand=0)

    def close(self):
        self.frame.destroy()
an class="hl kwa"></code> will return a failure, regardless of the use of <code>H5F_ACC_TRUNC</code>. <p> If the library does not detect that the file is already opened and <code>H5F_ACC_TRUNC</code> is not used, <code>H5Fcreate</code> will return a failure because the file already exists. Note that this is correct behavior. <p> But if the library does not detect that the file is already opened and <code>H5F_ACC_TRUNC</code> is used, <code>H5Fcreate</code> will truncate the existing file and return a valid file identifier. Such a truncation of a currently-opened file will almost certainly result in errors. While unlikely, the HDF5 library may not be able to detect, and thus report, such errors. <p> Applications should avoid calling <code>H5Fcreate</code> with an already opened file. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>const&nbsp;char&nbsp;*</em><code>name&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Name of the file to access.</td></tr> <tr> <td valign="top"><em>uintn</em> <code>flags</code></td> <td valign="top">IN: File access flags. Allowable values are: <ul><dl> <dt><code>H5F_ACC_TRUNC</code> <dd>Truncate file, if it already exists, erasing all data previously stored in the file. <dt><code>H5F_ACC_EXCL</code> <dd>Fail if file already exists. </dl></ul> <li><code>H5F_ACC_TRUNC</code> and <code>H5F_ACC_EXCL</code> are mutually exclusive; use exactly one. <li>An additional flag, <code>H5F_ACC_DEBUG</code>, prints debug information. This flag is used only by HDF5 library developers; <i>it is neither tested nor supported</i> for use in applications.</td></tr> <tr> <td valign="top"><em>hid_t</em>&nbsp;<code>create_id&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: File creation property list identifier, used when modifying default file meta-data. Use <code>H5P_DEFAULT</code> for default file creation properties.</td></tr> <tr> <td valign="top"><em>hid_t</em> <code>access_id</code></td> <td valign="top">IN: File access property list identifier. If parallel file access is desired, this is a collective call according to the communicator stored in the <code>access_id</code>. Use <code>H5P_DEFAULT</code> for default file access properties.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a file identifier if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fcreate_f <dd> <pre> SUBROUTINE h5fcreate_f(name, access_flags, file_id, hdferr, & creation_prp, access_prp) IMPLICIT NONE CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the file INTEGER, INTENT(IN) :: access_flag ! File access flags ! Possible values are: ! H5F_ACC_RDWR_F ! H5F_ACC_RDONLY_F ! H5F_ACC_TRUNC_F ! H5F_ACC_EXCL_F ! H5F_ACC_DEBUG_F INTEGER(HID_T), INTENT(OUT) :: file_id ! File identifier INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp ! File creation propertly ! list identifier, if not ! specified its value is ! H5P_DEFAULT_F INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp ! File access property list ! identifier, if not ! specified its value is ! H5P_DEFAULT_F END SUBROUTINE h5fcreate_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fflush" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-Flush">H5Fflush</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Fflush</code>(<em>hid_t </em><code>object_id</code>, <em>H5F_scope_t</em> <code>scope</code> ) <dt><strong>Purpose:</strong> <dd>Flushes all buffers associated with a file to disk. <dt><strong>Description:</strong> <dd><code>H5Fflush</code> causes all buffers associated with a file to be immediately flushed to disk without removing the data from the cache. <p> <code>object_id</code> can be any object associated with the file, including the file itself, a dataset, a group, an attribute, or a named data type. <p> <code>scope</code> specifies whether the scope of the flushing action is global or local. Valid values are <center> <table border=0> <tr><td align=left valign=top><code>H5F_SCOPE_GLOBAL</code></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td align=left valign=top>Flushes the entire virtual file.</td></tr> <tr><td align=left valign=top><code>H5F_SCOPE_LOCAL</code></td> <td></td> <td align=left valign=top>Flushes only the specified file.</td></tr> </table> </center> <dt><strong>Note:</strong> <dd>HDF5 does not possess full control over buffering. <code>H5Fflush</code> flushes the internal HDF5 buffers then asks the operating system (the OS) to flush the system buffers for the open files. After that, the OS is responsible for ensuring that the data is actually flushed to disk. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t </em><code>object_id</code></td> <td valign="top">IN: Identifier of object used to identify the file.</td></tr> <tr> <td valign="top"><em>H5F_scope_t</em>&nbsp;<code>scope&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Specifies the scope of the flushing action.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a non-negative value if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fflush_f <dd> <pre> SUBROUTINE h5fflush_f(obj_id, new_file_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier INTEGER, INTENT(IN) :: scope ! Flag with two possible values: ! H5F_SCOPE_GLOBAL_F ! H5F_SCOPE_LOCAL_F INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5fflush_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fget_access_plist" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-GetAccessPlist">H5Fget_access_plist</a> <dt><strong>Signature:</strong> <dd><em>hid_t </em><code>H5Fget_access_plist</code>(<em>hid_t</em> <code>file_id</code>) <dt><strong>Purpose:</strong> <dd>Returns a file access property list identifier. <dt><strong>Description:</strong> <dd><code>H5Fget_access_plist</code> returns the file access property list identifier of the specified file. <p> See "File Access Properties" in <a href="RM_H5P.html">H5P: Property List Interface</a> in this reference manual and "File Access Property Lists" in <a href="Files.html"><cite>Files</cite></a> in the <cite>HDF5 User's Guide</cite> for additional information and related functions. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t</em>&nbsp;<code>file_id&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Identifier of file to get access property list of</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a file access property list identifier if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fget_access_plist_f <dd> <pre> SUBROUTINE h5fget_access_plist_f(file_id, fcpl_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER(HID_T), INTENT(OUT) :: fapl_id ! File access property list identifier INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5fget_access_plist_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fget_create_plist" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-GetCreatePlist">H5Fget_create_plist</a> <dt><strong>Signature:</strong> <dd><em>hid_t </em><code>H5Fget_create_plist</code>(<em>hid_t</em> <code>file_id</code> ) <dt><strong>Purpose:</strong> <dd>Returns a file creation property list identifier. <dt><strong>Description:</strong> <dd><code>H5Fget_create_plist</code> returns a file creation property list identifier identifying the creation properties used to create this file. This function is useful for duplicating properties when creating another file. <p> See "File Creation Properties" in <a href="RM_H5P.html">H5P: Property List Interface</a> in this reference manual and "File Creation Properties" in <a href="Files.html"><cite>Files</cite></a> in the <cite>HDF5 User's Guide</cite> for additional information and related functions. <dt><strong>Parameters:</strong> <ul><table> <dt> <td valign="top"><em>hid_t</em>&nbsp;<code>file_id&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Identifier of the file to get creation property list of</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a file creation property list identifier if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fget_create_plist_f <dd> <pre> SUBROUTINE h5fget_create_plist_f(file_id, fcpl_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER(HID_T), INTENT(OUT) :: fcpl_id ! File creation property list ! identifier INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5fget_create_plist_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fget_filesize" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-GetFilesize">H5Fget_filesize</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Fget_filesize</code>(<em>hid_t</em> <code>file_id</code>, <em>hsize_t *</em><code>size</code> ) <dt><strong>Purpose:</strong> <dd>Returns the size of an HDF5 file. <dt><strong>Description:</strong> <dd><code>H5Fget_filesize</code> returns the size of the HDF5 file specified by <code>file_id</code>. <p> The returned size is that of the entire file, as opposed to only the HDF5 portion of the file. I.e., <code>size</code> includes the user block, if any, the HDF5 portion of the file, and any data that may have been appended beyond the data written through the HDF5 Library. <dt><strong>Parameters:</strong> <dl> <dt><em>hid_t</em> <code>file_id</code> <dd>IN: Identifier of a currently-open HDF5 file <dt><em>hsize_t *</em><code>size</code> <dd>OUT: Size of the file, in bytes. </dl> <dt><strong>Returns:</strong> <dd>Returns a non-negative value if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fget_freespace_f <dd> <pre> SUBROUTINE h5fget_filesize_f(file_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! file identifier INTEGER(HSIZE_T), INTENT(OUT) :: size ! Size of the file INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success, ! -1 if fail END SUBROUTINE h5fget_filesize_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fget_freespace" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-GetFreeSpace">H5Fget_freespace</a> <dt><strong>Signature:</strong> <dd><em>hssize_t </em><code>H5Fget_freespace</code>(<em>hid_t</em> <code>file_id</code>) <dt><strong>Purpose:</strong> <dd>Returns the amount of free space in a file. <dt><strong>Description:</strong> <dd>Given the identifier of an open file, <code>file_id</code>, <code>H5Fget_freespace</code> returns the amount of space that is unused by any objects in the file. <p> Currently, the HDF5 library only tracks free space in a file from a file open or create until that file is closed, so this routine will only report the free space that has been created during that interval. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t</em>&nbsp;<code>file_id&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Identifier of a currently-open HDF5 file</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a the amount of free space in the file if successful; otherwise returns a negative value. <dt><strong>Returns:</strong> <dd>Returns a file creation property list identifier if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fget_freespace_f <dd> <pre> SUBROUTINE h5fget_freespace_f(file_id, free_space, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER(HSSIZE_T), INTENT(OUT) :: free_space ! Amount of free space in file INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5fget_freespace_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fget_name" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-GetName">H5Fget_name</a> <dt><strong>Signature:</strong> <dd><em>ssize_t</em> <code>H5Fget_name</code>(<em>hid_t</em> <code>obj_id</code>, <em>char *</em><code>name</code>, <em>size_t</em> <code>size</code> ) <dt><strong>Purpose:</strong> <dd>Retrieves name of file to which object belongs. <dt><strong>Description:</strong> <dd><code>H5Fget_name</code> retrieves the name of the file to which the object <code>obj_id</code> belongs. The object can be a group, dataset, attribute, or named datatype. <p> Up to <code>size</code> characters of the filename are returned in <code>name</code>; additional characters, if any, are not returned to the user application. <p> If the length of the name, which determines the required value of <code>size</code>, is unknown, a preliminary <code>H5Fget_name</code> call can be made by setting <code>name</code> to NULL. The return value of this call will be the size of the filename; that value can then be assigned to <code>size</code> for a second <code>H5Fget_name</code> call, which will retrieve the actual name. <p> If an error occurs, the buffer pointed to by <code>name</code> is unchanged and the function returns a negative value. <dt><strong>Parameters:</strong> <dl> <dt><em>hid_t</em> <code>obj_id</code> <dd>IN: Identifier of the object for which the associated filename is sought. The object can be a group, dataset, attribute, or named datatype. <dt><em>char *</em><code>name</code> <dd>OUT: Buffer to contain the returned filename. <dt><em>size_t</em> <code>size</code> <dd>IN: Size, in bytes, of the <code>name</code> buffer. </dl> <dt><strong>Returns:</strong> <dd>Returns the length of the filename if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fget_name_f <dd> <pre> SUBROUTINE h5fget_name_f(obj_id, buf, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier CHARACTER(LEN=*), INTENT(INOUT) :: buf ! Buffer to hold filename INTEGER(SIZE_T), INTENT(OUT) :: size ! Size of the filename INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success, ! -1 if fail END SUBROUTINE h5fget_name_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fget_obj_count" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-GetObjCount">H5Fget_obj_count</a> <dt><strong>Signature:</strong> <dd><em>int </em><code>H5Fget_obj_count</code>(<em>hid_t</em> <code>file_id</code>, <em>unsigned int</em> <code>types</code> ) <dt><strong>Purpose:</strong> <dd>Returns the number of open object identifiers for an open file. <dt><strong>Description:</strong> <dd>Given the identifier of an open file, <code>file_id</code>, and the desired object types, <code>types</code>, <code>H5Fget_obj_count</code> returns the number of open object identifiers for the file. <p> To retrieve a count of open identifiers for open objects in all HDF5 application files that are currently open, pass the value <code>H5F_OBJ_ALL</code> in <code>file_id</code>. <p> The types of objects to be counted are specified in <code>types</code> as follows: <center> <table width=90% border=0> <tr><td valign=top> <code>H5F_OBJ_FILE</code> </td><td valign=top> Files only </td></tr><tr><td valign=top> <code>H5F_OBJ_DATASET</code> </td><td valign=top> Datasets only </td></tr><tr><td valign=top> <code>H5F_OBJ_GROUP</code> </td><td valign=top> Groups only </td></tr><tr><td valign=top> <code>H5F_OBJ_DATATYPE&nbsp;&nbsp;</code> </td><td valign=top> Named datatypes only </td></tr><tr><td valign=top> <code>H5F_OBJ_ATTR&nbsp;&nbsp;</code> </td><td valign=top> Attributes only </td></tr><tr><td valign=top> <code>H5F_OBJ_ALL</code> </td><td valign=top> All of the above <br> (I.e., <code>H5F_OBJ_FILE</code> | <code>H5F_OBJ_DATASET</code> | <code>H5F_OBJ_GROUP</code> | <code>H5F_OBJ_DATATYPE</code> | <code>H5F_OBJ_ATTR</code> ) </td></tr> </table> </center> Multiple object types can be combined with the logical <code>OR</code> operator (<code>|</code>). For example, the expression <code>(H5F_OBJ_DATASET|H5F_OBJ_GROUP)</code> would call for datasets and groups. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t</em> <code>file_id</code></td> <td valign="top">IN: Identifier of a currently-open HDF5 file or <code>H5F_OBJ_ALL</code> for all currently-open HDF5 files.</td></tr> <tr> <td valign="top"><em>unsigned&nbsp;int</em>&nbsp;<code>types&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Type of object for which identifiers are to be returned.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a the number of open objects if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fget_obj_count_f <dd> <pre> SUBROUTINE h5fget_obj_count_f(file_id, obj_type, obj_count, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER, INTENT(IN) :: obj_type ! Object types, possible values are: ! H5F_OBJ_FILE_F ! H5F_OBJ_GROUP_F ! H5F_OBJ_DATASET_F ! H5F_OBJ_DATATYPE_F ! H5F_OBJ_ALL_F INTEGER, INTENT(OUT) :: obj_count ! Number of opened objects INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5fget_obj_count_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fget_obj_ids" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-GetObjIDs">H5Fget_obj_ids</a> <dt><strong>Signature:</strong> <dd><em>int </em><code>H5Fget_obj_ids</code>(<em>hid_t</em> <code>file_id</code>, <em>unsigned int</em> <code>types</code>, <em>int</em> <code>max_objs</code>, <em>hid_t *</em><code>obj_id_list</code> ) <dt><strong>Purpose:</strong> <dd>Returns a list of open object identifiers. <dt><strong>Description:</strong> <dd>Given the file identifier <code>file_id</code> and the type of objects to be identified, <code>types</code>, <code>H5Fget_obj_ids</code> returns the list of identifiers for all open HDF5 objects fitting the specified criteria. <p> To retrieve identifiers for open objects in all HDF5 application files that are currently open, pass the value <code>H5F_OBJ_ALL</code> in <code>file_id</code>. <p> The types of object identifiers to be retrieved are specified in <code>types</code> using the codes listed for the same parameter in <a href="#File-GetObjCount"><code>H5Fget_obj_count</code></a> <p> To retrieve identifiers for all open objects, pass a negative value for the <code>max_objs</code>. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t</em> <code>file_id</code></td> <td valign="top">IN: Identifier of a currently-open HDF5 file or <code>H5F_OBJ_ALL</code> for all currently-open HDF5 files.</td></tr> <tr> <td valign="top"><em>unsigned int</em> <code>types</code></td> <td valign="top">IN: Type of object for which identifiers are to be returned.</td></tr> <tr> <td valign="top"><em>int</em> <code>max_objs</code></td> <td valign="top">IN: Maximum number of object identifiers to place into <code>obj_id_list</code>.</td></tr> <tr> <td valign="top"><em>hid_t&nbsp;*</em><code>obj_id_list&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">OUT: Pointer to the returned list of open object identifiers.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns number of objects placed into <code>obj_id_list</code> if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fget_obj_ids_f <dd> <pre> SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, max_objs, obj_ids, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER, INTENT(IN) :: obj_type ! Object types, possible values are: ! H5F_OBJ_FILE_F ! H5F_OBJ_GROUP_F ! H5F_OBJ_DATASET_F ! H5F_OBJ_DATATYPE_F ! H5F_OBJ_ALL_F INTEGER, INTENT(IN) :: max_objs ! Maximum number of object ! identifiers to retrieve INTEGER(HID_T), DIMENSION(*), INTENT(OUT) :: obj_ids ! Array of requested object ! identifiers INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5fget_obj_ids_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fget_vfd_handle" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-GetVfdHandle">H5Fget_vfd_handle</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Fget_vfd_handle</code>(<em>hid_t</em> <code>file_id</code>, <em>hid_t</em> <code>fapl_id</code>, <em>void *</em><code>file_handle</code> ) <dt><strong>Purpose:</strong> <dd>Returns pointer to the file handle from the virtual file driver. <dt><strong>Description:</strong> <dd>Given the file identifier <code>file_id</code> and the file access property list <code>fapl_id</code>, <code>H5Fget_vfd_handle</code> returns a pointer to the file handle from the low-level file driver currently being used by the HDF5 library for file I/O. <dt><strong>Notes:</strong> <dd>Users are not supposed to modify any file through this file handle. <p> This file handle is dynamic and is valid only while the file remains open; it will be invalid if the file is closed and reopened or opened during a subsequent session. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t</em> <code>file_id</code></td> <td valign="top">IN: Identifier of the file to be queried.</td></tr> <tr> <td valign="top"><em>hid_t</em> <code>fapl_id</code></td> <td valign="top">IN: File access property list identifier. For most drivers, the value will be <code>H5P_DEFAULT</code>. For the <code>FAMILY</code> or <code>MULTI</code> drivers, this value should be defined through the property list functions: <code>H5Pset_family_offset</code> for the <code>FAMILY</code> driver and <code>H5Pset_multi_type</code> for the <code>MULTI</code> driver.</td></tr> <tr> <td valign="top"><em>void&nbsp;*</em><code>file_handle&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">OUT: Pointer to the file handle being used by the low-level virtual file driver.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a non-negative value if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> <dd>None. <!-- <pre> SUBROUTINE </pre> --> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fis_hdf5" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-IsHDF5">H5Fis_hdf5</a> <dt><strong>Signature:</strong> <dd><em>htri_t </em><code>H5Fis_hdf5</code>(<em>const char *</em><code>name</code> ) <dt><strong>Purpose:</strong> <dd>Determines whether a file is in the HDF5 format. <dt><strong>Description:</strong> <dd><code>H5Fis_hdf5</code> determines whether a file is in the HDF5 format. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>const&nbsp;char&nbsp;*</em><code>name&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: File name to check format.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>When successful, returns a positive value, for <code>TRUE</code>, or <code>0</code> (zero), for <code>FALSE</code>. Otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fis_hdf5_f <dd> <pre> SUBROUTINE h5fis_hdf5_f(name, status, hdferr) IMPLICIT NONE CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the file LOGICAL, INTENT(OUT) :: status ! This parameter indicates ! whether file is an HDF5 file ! ( TRUE or FALSE ) INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5fis_hdf5_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fmount" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-Mount">H5Fmount</a> <dt><strong>Signature:</strong> <dd><em>herr_t</em> <code>H5Fmount</code>(<em>hid_t</em> <code>loc_id</code>, <em>const char *</em><code>name</code>, <em>hid_t</em> <code>child_id</code>, <em>hid_t</em> <code>plist_id</code> ) <dt><strong>Purpose:</strong> <dd>Mounts a file. <dt><strong>Description:</strong> <dd><code>H5Fmount</code> mounts the file specified by <code>child_id</code> onto the group specified by <code>loc_id</code> and <code>name</code> using the mount properties <code>plist_id</code>. <p> Note that <code>loc_id</code> is either a file or group identifier and <code>name</code> is relative to <code>loc_id</code>. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t</em> <code>loc_id</code></td> <td valign="top">IN: Identifier for of file or group in which <code>name</code> is defined.</td> <tr> <td valign="top"><em>const&nbsp;char&nbsp;*</em><code>name&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Name of the group onto which the file specified by <code>child_id</code> is to be mounted.</td> <tr> <td valign="top"><em>hid_t</em> <code>child_id</code></td> <td valign="top">IN: Identifier of the file to be mounted.</td> <tr> <td valign="top"><em>hid_t</em> <code>plist_id</code></td> <td valign="top">IN: Identifier of the property list to be used.</td> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a non-negative value if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fmount_f <dd> <pre> SUBROUTINE h5fmount_f(loc_id, name, child_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier CHARACTER(LEN=*), INTENT(IN):: name ! Group name at locationloc_id INTEGER(HID_T), INTENT(IN) :: child_id ! File(to be mounted) identifier INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5fmount_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fopen" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-Open">H5Fopen</a> <dt><strong>Signature:</strong> <dd><em>hid_t </em><code>H5Fopen</code>(<em>const char *</em><code>name</code>, <em>unsigned</em> <code>flags</code>, <em>hid_t</em> <code>access_id</code> ) <dt><strong>Purpose:</strong> <dd>Opens an existing file. <dt><strong>Description:</strong> <dd><code>H5Fopen</code> opens an existing file and is the primary function for accessing existing HDF5 files. <p> The parameter <code>access_id</code> is a file access property list identifier or <code>H5P_DEFAULT</code> if the default I/O access parameters are to be used <p> The <code>flags</code> argument determines whether writing to an existing file will be allowed. The file is opened with read and write permission if <code>flags</code> is set to <code>H5F_ACC_RDWR</code>. All flags may be combined with the bit-wise OR operator (`|') to change the behavior of the file open call. More complex behaviors of file access are controlled through the file-access property list. <p> The return value is a file identifier for the open file; this file identifier should be closed by calling <code>H5Fclose</code> when it is no longer needed. <p> <b>Special case -- Multiple opens:</b> <br> A file can often be opened with a new <code>H5Fopen</code> call without closing an already-open identifier established in a previous <code>H5Fopen</code> or <code>H5Fcreate</code> call. Each such <code>H5Fopen</code> call will return a unique identifier and the file can be accessed through any of these identifiers as long as the identifier remains valid. In such multiply-opened cases, all the open calls should use the same <code>flags</code> argument. <p> In some cases, such as files on a local Unix file system, the HDF5 library can detect that a file is multiply opened and will maintain coherent access among the file identifiers. <p> But in many other cases, such as parallel file systems or networked file systems, it is not always possible to detect multiple opens of the same physical file. In such cases, HDF5 will treat the file identifiers as though they are accessing different files and will be unable to maintain coherent access. Errors are likely to result in these cases. While unlikely, the HDF5 library may not be able to detect, and thus report, such errors. <p> It is generally recommended that applications avoid multiple opens of the same file. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>const&nbsp;char&nbsp;*</em><code>name&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Name of the file to access.</td></tr> <tr> <td valign="top"><em>unsigned</em> <code>flags</code></td> <td valign="top">IN: File access flags. Allowable values are: <ul><dl> <dt><code>H5F_ACC_RDWR</code> <dd>Allow read and write access to file. <dt><code>H5F_ACC_RDONLY</code> <dd>Allow read-only access to file. </dl> <li><code>H5F_ACC_RDWR</code> and <code>H5F_ACC_RDONLY</code> are mutually exclusive; use exactly one. <li>An additional flag, <code>H5F_ACC_DEBUG</code>, prints debug information. This flag is used only by HDF5 library developers; it is neither tested nor supported for use in applications. </ul></td></tr> <!-- NEW PAGE --> <tr> <td valign="top"><em>hid_t</em>&nbsp;<code>access_id&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Identifier for the file access properties list. If parallel file access is desired, this is a collective call according to the communicator stored in the <code>access_id</code>. Use <code>H5P_DEFAULT</code> for default file access properties.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a file identifier if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5fopen_f <dd> <pre> SUBROUTINE h5fopen_f(name, access_flags, file_id, hdferr, & access_prp) IMPLICIT NONE CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the file INTEGER, INTENT(IN) :: access_flag ! File access flags ! Possible values are: ! H5F_ACC_RDWR_F ! H5F_ACC_RDONLY_F INTEGER(HID_T), INTENT(OUT) :: file_id ! File identifier INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp ! File access property list ! identifier END SUBROUTINE h5fopen_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Freopen" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-Reopen">H5Freopen</a> <dt><strong>Signature:</strong> <dd><em>hid_t </em><code>H5Freopen</code>(<em>hid_t</em> <code>file_id</code> ) <dt><strong>Purpose:</strong> <dd>Returns a new identifier for a previously-opened HDF5 file. <dt><strong>Description:</strong> <dd><code>H5Freopen</code> returns a new file identifier for an already-open HDF5 file, as specified by <code>file_id</code>. Both identifiers share caches and other information. The only difference between the identifiers is that the new identifier is not mounted anywhere and no files are mounted on it. <p> Note that there is no circumstance under which <code>H5Freopen</code> can actually open a closed file; the file must already be open and have an active <code>file_id</code>. E.g., one cannot close a file with <code> H5Fclose&nbsp;(file_id) </code> then use <code> H5Freopen&nbsp;(file_id) </code> to reopen it. <p> The new file identifier should be closed by calling <code>H5Fclose</code> when it is no longer needed. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t</em>&nbsp;<code>file_id&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Identifier of a file for which an additional identifier is required.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a new file identifier if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5freopen_f <dd> <pre> SUBROUTINE h5freopen_f(file_id, new_file_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER(HID_T), INTENT(OUT) :: new_file_id ! New file identifier INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5freopen_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Funmount" --> <hr> <dl> <dt><strong>Name:</strong> <a name="File-Unmount">H5Funmount</a> <dt><strong>Signature:</strong> <dd><em>herr_t</em> <code>H5Funmount</code>(<em>hid_t</em> <code>loc_id</code>, <em>const char *</em><code>name</code> ) <dt><strong>Purpose:</strong> <dd>Unmounts a file. <dt><strong>Description:</strong> <dd>Given a mount point, <code>H5Funmount</code> dissassociates the mount point's file from the file mounted there. This function does not close either file. <p> The mount point can be either the group in the parent or the root group of the mounted file (both groups have the same name). If the mount point was opened before the mount then it is the group in the parent; if it was opened after the mount then it is the root group of the child. <p> Note that <code>loc_id</code> is either a file or group identifier and <code>name</code> is relative to <code>loc_id</code>. <dt><strong>Parameters:</strong> <ul><table> <tr> <td valign="top"><em>hid_t</em> <code>loc_id</code></td> <td valign="top">IN: File or group identifier for the location at which the specified file is to be unmounted.</td></tr> <tr> <td valign="top"><em>const&nbsp;char&nbsp;*</em><code>name&nbsp;&nbsp;&nbsp;&nbsp;</code></td> <td valign="top">IN: Name of the mount point.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a non-negative value if successful; otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5funmount_f <dd> <pre> SUBROUTINE h5funmount_f(loc_id, name, child_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier CHARACTER(LEN=*), INTENT(IN):: name ! Group name at location loc_id INTEGER, INTENT(OUT) :: hdferr ! Error code ! 0 on success and -1 on failure END SUBROUTINE h5funmount_f </pre> <!--<dt><strong>Non-C API(s):</strong> <dd> <img src="Graphics/Java.gif"> <img src="Graphics/C++.gif"> --> </dl> <!-- #BeginLibraryItem "/ed_libs/NavBar_RM.lbi" --><hr> <center> <table border=0 width=98%> <tr><td valign=top align=left> <a href="index.html">HDF5 documents and links</a>&nbsp;<br> <a href="H5.intro.html">Introduction to HDF5</a>&nbsp;<br> <a href="http://hdf.ncsa.uiuc.edu/HDF5/doc/UG/index.html">HDF5 User Guide</a>&nbsp;<br> <!-- <a href="Glossary.html">Glossary</a><br> --> </td> <td valign=top align=right> And in this document, the <a href="RM_H5Front.html">HDF5 Reference Manual</a>&nbsp;&nbsp; <br> <a href="RM_H5.html">H5</a>&nbsp;&nbsp; <a href="RM_H5A.html">H5A</a>&nbsp;&nbsp; <a href="RM_H5D.html">H5D</a>&nbsp;&nbsp; <a href="RM_H5E.html">H5E</a>&nbsp;&nbsp; <a href="RM_H5F.html">H5F</a>&nbsp;&nbsp; <a href="RM_H5G.html">H5G</a>&nbsp;&nbsp; <a href="RM_H5I.html">H5I</a>&nbsp;&nbsp; <a href="RM_H5P.html">H5P</a>&nbsp;&nbsp; <br> <a href="RM_H5R.html">H5R</a>&nbsp;&nbsp; <a href="RM_H5S.html">H5S</a>&nbsp;&nbsp; <a href="RM_H5T.html">H5T</a>&nbsp;&nbsp; <a href="RM_H5Z.html">H5Z</a>&nbsp;&nbsp; <a href="Tools.html">Tools</a>&nbsp;&nbsp; <a href="PredefDTypes.html">Datatypes</a>&nbsp;&nbsp; </td></tr> </table> </center> <hr><!-- #EndLibraryItem --><!-- #BeginLibraryItem "/ed_libs/Footer.lbi" --><address> <a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a> <br> Describes HDF5 Release 1.7, the unreleased development branch; working toward HDF5 Release 1.8.0 </address><!-- #EndLibraryItem --><SCRIPT LANGUAGE="JAVASCRIPT"> <!-- document.writeln("Last modified: 24 August 2004"); --> </SCRIPT> </body> </html>