2
LibGViewer - GTK+ File Viewer library
3
Copyright (C) 2006 Assaf Gordon
6
GNOME Commander - A GNOME based file manager
7
Copyright (C) 2001-2006 Marcus Bjurman
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2 of the License, or
12
(at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
#ifndef __LIBGVIEWER_FILEOPS_H__
25
#define __LIBGVIEWER_FILEOPS_H__
28
File Handling functions (based on Midnight Commander's view.c)
30
'open' & 'close' : just open and close the file handle
31
'load' & 'free' : allocate & free buffer memory, call mmap/munmap
33
calling order should be: open->load->[use file with "get_byte"]->free (which calls close)
37
typedef struct _ViewerFileOps ViewerFileOps;
39
ViewerFileOps* gv_fileops_new();
44
int gv_file_open(ViewerFileOps *ops, const gchar* _file);
46
int gv_file_open_fd(ViewerFileOps *ops, int filedesc);
50
returns: NULL on success
52
char *gv_file_load (ViewerFileOps *ops, int fd);
55
return values: NULL for success, else points to error message
57
char *gv_file_init_growing_view (ViewerFileOps *ops, const char *filename);
60
returns: -1 on failure
61
0->255 value on success
63
int gv_file_get_byte (ViewerFileOps *ops, offset_type byte_index);
65
offset_type gv_file_get_max_offset(ViewerFileOps *ops);
67
void gv_file_close (ViewerFileOps *ops);
69
void gv_file_free (ViewerFileOps *ops);